
/* =========================================================
   GLOBAL COLOUR + FOOTER AUDIT v106
   Rule: no washed-out cyan/pale blue-green panel or button fills.
   Teal remains an accent, not a large background surface.
   ========================================================= */

/* ---------- Stable palette ---------- */
html[data-theme="light"]{
  --bg:#f6f4ef;
  --surface:#fffdfa;
  --surface2:#f0eee8;
  --text:#1d2c31;
  --muted:#657278;
  --line:#d9d5cd;
  --primary:#176f69;
  --primary2:#173249;
  --accent:#c98925;
  --neutral-button:#fffdfa;
  --neutral-button-hover:#f1eee7;
  --neutral-panel:#f7f5f0;
}

html[data-theme="dark"]{
  --bg:#091217;
  --surface:#101b21;
  --surface2:#162229;
  --text:#e8efed;
  --muted:#a8b3b1;
  --line:#303d42;
  --primary:#67c6bd;
  --primary2:#e1ecea;
  --accent:#dda84a;
  --neutral-button:#121e24;
  --neutral-button-hover:#1a282f;
  --neutral-panel:#111d23;
}

/* ---------- Ban pale-cyan surfaces globally ---------- */
body,
main{
  background:var(--bg)!important;
}

/* Large neutral page/section surfaces */
.section.alt,
.story-map-shell,
.story-chapter,
.story-record-cell,
.card,
.project-card,
.profile-card,
.contact-card,
.snapshot-card,
.theme-card,
.home-column,
.publication-preview article,
.pub-summary,
.case-metric,
.media-note,
.credential-card,
.credential-record,
.education-degree-card,
.tc-record,
.tc-summary-card,
.automation-project-detail,
.platform-reference-card,
.evidence-record,
.workflow-card,
.academic-method-note,
.professor-contact-details{
  background:var(--surface)!important;
  border-color:var(--line)!important;
}

/* Secondary surfaces use neutral beige/gray in light mode and charcoal in dark. */
.tags span,
.pill,
.outcomes div,
.tc-summary-meta span,
.automation-project-tags span,
.workflow-card figcaption,
.flightplan-card figcaption,
.story-map-head,
.story-step,
.education-degree-topline strong,
.education-degree-body>div,
.up-v53-chipwrap span,
.up-v53-keywords span,
.up-v53-inline-note,
.up-v53-mini-grid>div,
.up-v53-map-status{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
}

/* Buttons: neutral surfaces only, no pale teal fills. */
button,
.button,
.btn,
.story-more,
.ha-actions a,
.ha-finale-track a,
.ha-o6-play,
.story-map-reset,
.field-map-head button,
.field-map-filters button,
.automation-project-tab,
.credential-action,
.up-v53-youtube-row a,
.back-to-top{
  background:var(--neutral-button)!important;
  border-color:var(--line)!important;
  color:var(--primary2)!important;
}

button:hover,
.button:hover,
.btn:hover,
.story-more:hover,
.ha-actions a:hover,
.ha-finale-track a:hover,
.ha-o6-play:hover,
.story-map-reset:hover,
.field-map-head button:hover,
.field-map-filters button:hover,
.automation-project-tab:hover,
.credential-action:hover,
.up-v53-youtube-row a:hover,
.back-to-top:hover{
  background:var(--neutral-button-hover)!important;
  border-color:color-mix(in srgb,var(--accent) 55%,var(--line))!important;
  color:var(--primary2)!important;
}

/* Primary/active controls use deep navy/charcoal with gold accent, not cyan fill. */
.ha-actions .ha-primary,
.field-map-filters button.active,
.ha-o6-steps button.active,
.story-chapter.is-active .story-more,
.automation-project-tab.active{
  background:#173249!important;
  color:#fff!important;
  border-color:var(--accent)!important;
}

html[data-theme="dark"] .ha-actions .ha-primary,
html[data-theme="dark"] .field-map-filters button.active,
html[data-theme="dark"] .ha-o6-steps button.active,
html[data-theme="dark"] .automation-project-tab.active{
  background:#182932!important;
  color:#fff!important;
  border-color:var(--accent)!important;
}

/* ---------- Home ---------- */
html[data-theme="light"] .home-atlas-page{
  background:#f4f1ea!important;
}
html[data-theme="dark"] .home-atlas-page{
  background:var(--bg)!important;
}

html[data-theme="light"] .home-atlas-page .ha-hero{
  background:linear-gradient(125deg,#fbf9f4 0%,#f3efe7 55%,#ece7de 100%)!important;
}
html[data-theme="dark"] .home-atlas-page .ha-hero{
  background:linear-gradient(125deg,#0a151a 0%,#101d23 55%,#142329 100%)!important;
}

.home-atlas-page .ha-research-spread,
.home-atlas-page .ha-capability-atlas,
.home-atlas-page .ha-academic-finale{
  background:var(--neutral-panel)!important;
  border-color:var(--line)!important;
}

.home-atlas-page .ha-result-dials div,
.home-atlas-page .ha-summary-card,
.home-atlas-page .ha-work-card,
.home-atlas-page .ha-education-card,
.home-atlas-page .ha-certificate-grid>a{
  background:var(--surface)!important;
  border-color:var(--line)!important;
}

/* Publications stays intentionally deep in BOTH themes. */
.home-atlas-page .ha-publication-band{
  background:linear-gradient(120deg,#173448,#213e4d)!important;
  color:#f7faf8!important;
}
html[data-theme="dark"] .home-atlas-page .ha-publication-band{
  background:linear-gradient(120deg,#0b1920,#112832)!important;
}
.home-atlas-page .ha-publication-copy h2,
.home-atlas-page .ha-publication-copy a,
.home-atlas-page .ha-pub-numbers strong{
  color:#f7faf8!important;
}
.home-atlas-page .ha-publication-copy p,
.home-atlas-page .ha-pub-numbers span{
  color:#c8d3d3!important;
}

/* Journey panel/control: deep neutral, no washed-out translucent mint. */
.home-atlas-page .ha-o6-panel{
  background:rgba(15,28,34,.96)!important;
  border-color:#3a494e!important;
  color:#f1f4f3!important;
}
.home-atlas-page .ha-o6-play{
  background:rgba(18,30,36,.96)!important;
  border-color:#48565a!important;
  color:#f2f5f4!important;
}
html[data-theme="light"] .home-atlas-page .ha-o6-play{
  background:#fffdfa!important;
  color:#173249!important;
  border-color:#d9d5cd!important;
}

/* Statistics strip: warm light neutral / deep charcoal dark. */
html[data-theme="light"] .home-atlas-page .ha-signal-strip{
  background:#ece9e2!important;
  border-color:#d7d2c9!important;
  color:#173249!important;
}
html[data-theme="dark"] .home-atlas-page .ha-signal-strip{
  background:#111f25!important;
  border-color:#334147!important;
  color:#edf2f0!important;
}
html[data-theme="light"] .home-atlas-page .ha-signal-strip strong{color:#173249!important}
html[data-theme="light"] .home-atlas-page .ha-signal-strip span,
html[data-theme="light"] .home-atlas-page .ha-signal-strip small{color:#67747a!important}
html[data-theme="dark"] .home-atlas-page .ha-signal-strip strong{color:#f2f5f4!important}
html[data-theme="dark"] .home-atlas-page .ha-signal-strip span,
html[data-theme="dark"] .home-atlas-page .ha-signal-strip small{color:#aab5b3!important}

/* ---------- Research / StoryMap ---------- */
body.story-page .story-map-shell,
body.story-page .story-chapter{
  background:var(--surface)!important;
}
body.story-page .story-map-head{
  background:var(--surface2)!important;
}

/* Research active marker: gold; inactive marker: navy/charcoal. */
body[data-story-page="research"] .story-leaflet-icon span{
  background:#173249!important;
  color:#fff!important;
}
body[data-story-page="research"] .story-leaflet-icon.active span{
  background:var(--accent)!important;
  color:#10252b!important;
}

/* ---------- UAV / Field ---------- */
.uav-field-page .platform-reference-card,
.uav-field-page .evidence-record,
.uav-field-page .workflow-card,
.uav-field-page .flightplan-card,
.uav-field-page .academic-method-note,
.uav-field-page .academic-map-card,
.uav-field-page .academic-map-card-wide{
  background:var(--surface)!important;
}
.uav-field-page .workflow-card figcaption,
.uav-field-page .flightplan-card figcaption{
  background:var(--surface2)!important;
}

/* ---------- GIS Automation ---------- */
.automation-compact-page .automation-project-detail{
  background:var(--surface)!important;
}
.automation-compact-page .automation-project-format,
.automation-compact-page .automation-project-reviewer,
.automation-compact-page .automation-project-tags span,
.automation-compact-page .automation-academic-domains span,
.automation-compact-page .automation-project-visual figcaption{
  background:var(--surface2)!important;
}

/* ---------- Urban / Education / Teaching / Credentials ---------- */
.urban-planning-page .up-v53-story-card,
.urban-planning-page .up-v53-map-sticky,
.urban-planning-page .up-v53-media-row figure,
.urban-planning-page .up-v53-main-visual,
.simple-education-page .education-degree-card,
.teaching-capacity-page .tc-record,
.teaching-capacity-page .tc-summary-card,
.credential-page .credential-record{
  background:var(--surface)!important;
  border-color:var(--line)!important;
}

/* ---------- Footer: compact and synchronized ---------- */
.site-footer{
  margin:0!important;
  padding:0!important;
  background:var(--neutral-panel)!important;
  border-top:1px solid var(--line)!important;
}

.footer-academic{
  width:min(var(--max),calc(100% - 40px))!important;
  margin:0 auto!important;
}

.footer-academic-main{
  min-height:0!important;
  padding:11px 0 8px!important;
  gap:24px!important;
}

.footer-visual{
  height:36px!important;
  width:218px!important;
  max-width:27vw!important;
}

.footer-academic-meta{
  padding:5px 0 7px!important;
  border-top:1px solid var(--line)!important;
}

/* Page frame:
   - short pages: footer sits at the bottom of the viewport
   - long pages: footer follows content naturally
   - no empty canvas can appear below the footer */
html{
  min-height:100%!important;
}

body.footer-layout{
  min-height:100vh!important;
  min-height:100svh!important;
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto!important;
  align-content:stretch!important;
}

body.footer-layout>main{
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  margin:0!important;
}

body.footer-layout>.site-footer{
  width:100%!important;
  align-self:end!important;
  margin:0!important;
}

/* Final content block -> footer spacing. */
main>:last-child{
  margin-bottom:0!important;
}
main>.section:last-child,
main>section:last-child{
  padding-bottom:30px!important;
}

/* Story pages and long specialist pages */
body.story-page .spatial-story{
  padding-bottom:30px!important;
}
body.uav-field-page .field-evidence-section,
body.credential-page .credential-record-section,
body.teaching-capacity-page .tc-shell,
body.urban-planning-page .up-shell,
body.portfolio-route-page .portfolio-route-section,
body.automation-compact-page .automation-compact-section,
body.simple-education-page .education-simple-section{
  padding-bottom:30px!important;
}

/* Remove common full-screen/min-height footer gaps. */
.story-layout,
.story-map-column,
.story-chapters,
.tc-shell,
.up-shell,
.automation-compact-section,
.education-simple-section,
.credential-record-section,
.field-evidence-section,
.portfolio-route-section{
  min-height:0!important;
}

/* Avoid excess blank margin on final cards/records. */
.story-chapters>*:last-child,
.field-evidence-section .evidence-record:last-child,
.tc-shell>*:last-child,
.credential-record-section>*:last-child,
.education-simple-section>*:last-child,
.automation-compact-section>*:last-child,
.up-shell>*:last-child{
  margin-bottom:0!important;
}

/* Footer mobile remains compact. */
@media(max-width:700px){
  .footer-academic{
    width:calc(100% - 32px)!important;
  }
  .footer-academic-main{
    padding:10px 0 7px!important;
  }
  .footer-visual{
    width:190px!important;
    height:34px!important;
    max-width:100%!important;
  }
  .footer-academic-meta{
    padding:5px 0 7px!important;
  }

  main>.section:last-child,
  main>section:last-child,
  body.story-page .spatial-story,
  body.uav-field-page .field-evidence-section,
  body.credential-page .credential-record-section,
  body.teaching-capacity-page .tc-shell,
  body.urban-planning-page .up-shell,
  body.portfolio-route-page .portfolio-route-section,
  body.automation-compact-page .automation-compact-section,
  body.simple-education-page .education-simple-section{
    padding-bottom:26px!important;
  }
}

/* Natural media stays natural. */
img,video{
  filter:none!important;
}


/* =========================================================
   FOOTER STRUCTURE AUDIT v107
   ========================================================= */

/* The footer is always the final in-flow row on shared pages. */
body.footer-layout>.site-footer{
  box-sizing:border-box!important;
  position:relative!important;
  inset:auto!important;
}

/* Do not let an old footer rule create an artificial minimum height. */
body.footer-layout .site-footer,
body.footer-layout .footer-academic,
body.footer-layout .footer-academic-main,
body.footer-layout .footer-academic-meta{
  min-height:0!important;
}

/* Last content element should not add an unexplained margin before footer. */
body.footer-layout main>:last-child,
body.footer-layout main>:last-child>:last-child{
  margin-bottom:0!important;
}

/* Expertise is intentionally short; its page section fills the available
   main row while the cards remain at the top. This avoids a detached footer. */
body.footer-layout[data-story-page="skills"] .spatial-story{
  min-height:100%!important;
  box-sizing:border-box!important;
}

/* Same stable frame for other compact StoryMap pages. */
body.footer-layout.compact-story-page .spatial-story{
  box-sizing:border-box!important;
}

/* Fixed/overlay UI must never participate in page height. */
body.footer-layout .back-to-top,
body.footer-layout .field-lightbox{
  margin:0!important;
}

/* Mobile browser bars: use dynamic viewport height when supported. */
@supports (height:100dvh){
  body.footer-layout{
    min-height:100dvh!important;
  }
}
