/* =========================================================
   SAWGraph Shared Stylesheet
   ========================================================= */


/* ---------- Color Variables ---------- */

:root {
  --saw-blue: #0066cc;
  --saw-blue-dark: #004499;
  --saw-heading-blue: #1a4d7a;
  --saw-subheading-blue: #2a5c91;

  --saw-pale-blue: #f0f4ff;
  --saw-light-grey: #f8f9fa;
  --saw-border-grey: #e5e5e5;

  --saw-text: #333333;
  --saw-muted-text: #555555;

  --saw-shadow:
    0 2px 6px rgba(0, 0, 0, 0.08);

  --saw-shadow-hover:
    0 4px 12px rgba(0, 102, 204, 0.15);
}


/* ---------- General Page Layout ---------- */

html {
  scroll-padding-top: 75px;
}

body {
  color: var(--saw-text);
  font-family: Verdana, sans-serif;
  font-size: 15px;
}

.site-main {
  max-width: 1564px;
  margin: 0 auto;
  padding: 80px 16px 0;
}

p {
  line-height: 1.7;
}

ul,
ol {
  line-height: 1.8;
}

li {
  margin-bottom: 10px;
}


/* ---------- Site Navigation ---------- */

.w3-top {
  z-index: 20000;
}

/*
   Desktop navigation appears above 850px.
   Mobile hamburger navigation appears at 850px and below.

   W3.CSS provides the basic appearance of submenu items.
   These rules control layout, dropdown behavior, and the
   desktop/mobile switch.
*/


/*
   W3.CSS normally hides overflow on .w3-bar.
   Desktop dropdowns need to extend below the fixed
   navigation ribbon.
*/

.w3-top > .w3-bar {
  overflow: visible;
  letter-spacing: normal;
}


/* Site identity */

.w3-bar .site-identity {
  letter-spacing: 4px;
}

/* Desktop navigation container */

.desktop-nav {
  float: right;
  display: flex;
  align-items: stretch;
  letter-spacing: normal;
}


/* Tagline displayed only on wide desktop screens */

.desktop-tagline {
  display: none;
}

/*
   On sufficiently wide screens, place the tagline
   between the SAWGraph identity and the main menu.
*/

@media (min-width: 1300px) {

  .desktop-tagline {
    display: block;
    float: left;

    padding: 8px 12px;

    color: var(--saw-muted-text);

    font-size: 0.9em;
    font-weight: 400;
    line-height: inherit;

    white-space: nowrap;
    letter-spacing: normal;

    position: relative;
    top: 2px;
   
  }

}


/* Each top-level menu item */

.desktop-menu-item {
  position: relative;
  display: block;
}


/* Top-level desktop headings */

.w3-bar .desktop-menu-heading {
  float: none;
  display: block;
  width: auto;

  padding: 8px 16px;

  color: inherit;
  background: transparent;

  font: inherit;
  line-height: inherit;

  white-space: nowrap;
  letter-spacing: normal;

  text-decoration: none;
  cursor: default;
}


/* Linked headings remain clickable */

.w3-bar a.desktop-menu-heading {
  cursor: pointer;
}


/* Match the normal W3.CSS navigation hover effect */

.w3-bar a.desktop-menu-heading:hover {
  background-color: #ccc;
  color: #000;
  text-decoration: none;
}


/* Desktop dropdown menus */

.desktop-dropdown {
  display: none;

  position: absolute;
  top: 100%;
  left: 0;

  width: max-content;
  min-width: 220px;
  max-width: calc(100vw - 32px);

  background: white;

  z-index: 10000;

  letter-spacing: normal;
}


/* Keep menus near the right edge inside the viewport */

.desktop-dropdown.dropdown-right {
  left: auto;
  right: 0;
}


/* Show only the submenu belonging to the hovered heading */

.desktop-menu-item:hover > .desktop-dropdown {
  display: block;
}


/*
   The outer navigation is a horizontal .w3-bar.
   Explicitly restore vertical behavior inside each
   desktop dropdown so submenu items stack like the
   rows in the mobile menu.
*/

.w3-bar .desktop-dropdown .w3-bar-item {
  float: none !important;
  display: block !important;
  width: 100% !important;

  padding: 8px 16px;

  text-align: left;
  white-space: nowrap;
  letter-spacing: normal;
}


/* Mobile navigation */

/*
   Hide the hamburger on desktop.

   !important is needed because W3.CSS gives
   .w3-bar-item its own display rule.
*/

.w3-bar .mobile-menu-button {
  display: none !important;
}


/* Preserve normal text spacing in the mobile menu */

.mobile-site-menu {
  letter-spacing: normal;
}


/*
   Prevent an opened mobile menu from remaining visible
   if the viewport changes to desktop width.
*/

@media (min-width: 851px) {

  .mobile-site-menu {
    display: none !important;
  }

}


/* ---------- Links ---------- */

/*
   Main-content links only.
   This prevents these rules from changing the appearance
   of navigation links created by menu.js.
*/

.site-main a {
  color: var(--saw-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-main a:hover {
  color: var(--saw-blue-dark);
  text-decoration: underline;
}


/* ---------- Page and Section Headings ---------- */

/* Primary title on interior pages */

.page-title {
  color: #1a1a1a;
  font-size: 2.5em;
  font-weight: 700;
  margin: 0 0 30px;
  padding-bottom: 15px;
  border-bottom: 3px solid var(--saw-blue);
}


/* Major page sections */

.section-title {
  color: var(--saw-blue);
  font-size: 1.8em;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--saw-blue);
}


/* Subsections within a major section */

.subsection-title {
  color: var(--saw-subheading-blue);
  font-size: 1.35em;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 14px;
}


/* ---------- Introductory / Highlighted Sections ---------- */

.intro-section {
  background: var(--saw-pale-blue);
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 40px;
  border-left: 5px solid var(--saw-blue);
}

.intro-section p:first-child {
  margin-top: 0;
}

.intro-section p:last-child {
  margin-bottom: 0;
}


/* General callout using the same visual vocabulary */

.callout-section {
  background: var(--saw-pale-blue);
  padding: 25px;
  border-radius: 8px;
  margin: 30px 0;
  border-left: 5px solid var(--saw-blue);
}


/* ---------- Home Page Header ---------- */

.home-header {
  padding-bottom: 20px;
  overflow: auto;
}

.header-logo {
  float: left;
  margin: 10px 35px 20px 0;
  max-width: 380px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--saw-shadow);

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.header-logo:hover {
  transform: translateY(-4px);
  box-shadow: var(--saw-shadow-hover);
}

.home-intro-text {
  overflow: hidden;
}

.project-title {
  color: var(--saw-heading-blue);
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 0;
  margin-bottom: 12px;
}

.project-subtitle {
  color: var(--saw-subheading-blue);
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.5;
}


/* ---------- Split Content Panels ---------- */

/*
   Generic two-column panel for text paired with an image,
   interactive map, or other visual content.
*/

.split-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.4fr) minmax(0, 1.6fr);
  gap: 30px;
  align-items: center;

  background: var(--saw-pale-blue);
  border-left: 5px solid var(--saw-blue);
  border-radius: 8px;

  padding: 24px;
  margin: 30px 0 40px;

  box-shadow: var(--saw-shadow);
}

.split-panel-top {
  align-items: start;
}

.split-panel-text h3 {
  color: var(--saw-subheading-blue);
  font-size: 1.35em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 16px;
}

.split-panel-text p {
  margin-top: 0;
  margin-bottom: 16px;
}

.split-panel-text p:last-child {
  margin-bottom: 0;
}

.split-panel img {
  display: block;
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 0 auto;
}


/* ---------- Content Figures ---------- */

.content-figure {
  margin: 30px auto 40px;
  text-align: center;
}

.content-figure img {
  display: block;
  width: 100%;
  max-width: 1100px;
  height: auto;
  margin: 0 auto;
}

.content-figure figcaption {
  margin-top: 10px;
  color: var(--saw-muted-text);
  font-size: 0.9em;
  line-height: 1.5;
}


/* ---------- Interactive Maps ---------- */

.folium-map {
  position: relative;
  width: 100%;
  height: 500px;
  min-width: 0;

  /*
     Keep Leaflet panes and controls inside the map's
     stacking context so they remain below site navigation.
  */
  z-index: 0;
  isolation: isolate;
}

.leaflet-container {
  font-size: 1rem;
}

.foliumtooltip {
  margin: auto;
}

.foliumtooltip table {
  margin: auto;
}

.foliumtooltip tr {
  text-align: left;
}

.foliumtooltip th {
  padding: 2px 8px 2px 2px;
}

.map-instructions {
  font-size: 0.95em;
  color: var(--saw-muted-text);
}

/* Maps with external Leaflet layer controls */

.map-with-layers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.map-layer-panel {
  min-width: 220px;
  max-width: 300px;
}

.map-layer-panel .leaflet-control {
  float: none;
  margin: 0;
}

.map-layer-panel .leaflet-control-layers {
  width: 100%;
  max-height: 500px;
  overflow-y: auto;
  box-sizing: border-box;
}


/* ---------- Data Tables ---------- */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 25px 0 40px;
}

.data-table {
  min-width: 1100px;
}

.data-table th {
  color: var(--saw-heading-blue);
  font-weight: 600;
  vertical-align: top;
}

.data-table td {
  vertical-align: top;
}

.data-table th,
.data-table td {
  line-height: 1.5;
}



/* ---------- Content Cards ---------- */

/*
   Generic card grids for use cases, demo concepts,
   exploration options, and similar grouped content.
*/

.card-grid {
  display: grid;
  gap: 24px;
  margin: 25px 0 40px;
}

.card-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-card {
  min-width: 0;

  background: var(--saw-light-grey);
  border-left: 5px solid var(--saw-blue);
  border-radius: 6px;

  padding: 22px;

  box-shadow: var(--saw-shadow);
}

.content-card h3 {
  color: var(--saw-blue);
  font-size: 1.25em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 14px;
}

.content-card p:first-child {
  margin-top: 0;
}

.content-card p:last-child {
  margin-bottom: 0;
}


/* ---------- Multi-column Information Lists ---------- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 35px;
  margin: 20px 0 35px;
}

.info-item {
  margin: 0;
}

.info-item strong {
  color: var(--saw-heading-blue);
}


/* ---------- Action Buttons ---------- */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
}

.site-main a.site-button {
  display: inline-block;

  padding: 12px 20px;

  background: var(--saw-blue);
  color: white;

  font-weight: 600;
  text-decoration: none;

  border-radius: 5px;

  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.site-main a.site-button:hover {
  background: var(--saw-blue-dark);
  color: white;
  text-decoration: none;
  transform: translateY(-2px);
}


/* Secondary section-link buttons */

.site-main a.site-button-secondary {
  display: inline-block;

  padding: 10px 18px;

  border: 2px solid var(--saw-blue);

  color: var(--saw-blue);
  background: white;

  font-weight: 600;
  text-decoration: none;

  border-radius: 5px;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.site-main a.site-button-secondary:hover {
  background: var(--saw-pale-blue);
  color: var(--saw-blue-dark);
  text-decoration: none;
  transform: translateY(-2px);
}


/* ---------- Responsive Video ---------- */

.video-container {
  width: 100%;
  max-width: 800px;
  margin: 25px auto 40px;
}

.video-container iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}


/* ---------- Publications ---------- */

.publication-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 25px 0 40px;
}

.publication-card {
  display: flex;
  flex-direction: column;

  background: var(--saw-light-grey);
  border-left: 5px solid var(--saw-blue);
  border-radius: 6px;

  padding: 22px;

  box-shadow: var(--saw-shadow);

  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.publication-card:hover {
  background: var(--saw-pale-blue);
  box-shadow: var(--saw-shadow-hover);
  transform: translateY(-3px);
}

.publication-card h3 {
  color: var(--saw-blue);
  font-size: 1.25em;
  font-weight: 600;
  line-height: 1.4;

  margin-top: 0;
  margin-bottom: 14px;
}

.publication-card p {
  line-height: 1.55;
  margin-top: 0;
}

.publication-card cite {
  color: var(--saw-muted-text);
}

.publication-access {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 8px;
}

@media (max-width: 850px) {

  .publication-grid {
    grid-template-columns: 1fr;
  }

}


/* ---------- Site Footer ---------- */

.site-footer {
  background: var(--saw-heading-blue);
  color: white;
  text-align: center;
  padding: 32px 20px;
  margin-top: 48px;
}

.site-footer p {
  margin: 0;
  font-size: 1.2em;
  font-weight: 500;
  letter-spacing: 0.2px;
}


/* ---------- Back to Top Button ---------- */

#backToTop {
  display: none;

  position: fixed;
  bottom: 40px;
  right: 40px;

  z-index: 99;

  border: none;
  outline: none;

  background-color: var(--saw-heading-blue);
  color: white;

  cursor: pointer;

  width: 52px;
  height: 52px;
  padding: 0;

  border-radius: 50%;

  font-size: 20px;

  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2);

  transition:
    background-color 0.3s ease,
    transform 0.3s ease;
}

#backToTop:hover {
  background-color: var(--saw-blue);
  transform: scale(1.08);
}


/* ---------- Responsive Styles ---------- */

@media (max-width: 850px) {

  /* Navigation */

  .desktop-nav {
    display: none !important;
  }

  .w3-bar .mobile-menu-button {
    display: block !important;
  }


  /* Home page */

  .header-logo {
    float: none;
    display: block;
    max-width: 90%;
    margin: 0 auto 30px;
  }

  .home-intro-text {
    overflow: visible;
  }


  /* Split panels */

  .split-panel {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .split-panel img {
    max-width: 100%;
  }


  /* Content grids */

  .card-grid-2,
  .card-grid-3,
  .info-grid {
    grid-template-columns: 1fr;
  }


  /* Interactive maps */

  .folium-map {
    height: 450px;
  }

   .map-with-layers {
    grid-template-columns: 1fr;
  }

  .map-layer-panel {
    width: 100%;
    max-width: none;
  }

  .map-layer-panel .leaflet-control-layers {
    max-height: none;
  }
   
}


@media (max-width: 600px) {

  .site-main {
    padding-top: 75px;
  }

  .page-title {
    font-size: 1.8em;
    margin-bottom: 20px;
  }

  .section-title {
    font-size: 1.5em;
  }

  .project-title {
    font-size: 1.35em;
  }

  .project-subtitle {
    font-size: 1.1em;
  }

  .intro-section,
  .callout-section,
  .split-panel {
    padding: 18px;
  }

  .content-card,
  .publication-card {
    padding: 18px;
  }

  .folium-map {
    height: 400px;
  }

  .button-row {
    flex-direction: column;
  }

  .site-main a.site-button,
  .site-main a.site-button-secondary {
    text-align: center;
  }

  #backToTop {
    bottom: 25px;
    right: 25px;
  }

}
