/* style5b.css - base on style5.css with room for page-specific overrides */
@import url("style5.css");

/* Fixed Menu button - always visible in top right corner */
.menu-button {
    position: fixed !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 1500 !important; /* Above page content but below modals (z-index: 2000) */
    margin: 0 !important; /* Remove any existing margins */
}

/* Page-specific overrides for trends5.html can be added below */

/* Remove underline for links within trends section */
#trends a { text-decoration: none; color: #7A93C7; }

/* Center trends headers */
#trends h2,
#trends h3 { text-align: center; }

/* (Removed header/nav overrides to mirror index5 mobile banner exactly) */

/* Stack headers with 100px spacing and center them */
#trends .trend-tip {
  display: block;
  text-align: center;
  margin: 0 !important; /* reset shorthand */
}

/* Explicitly control spacing on the h3 elements themselves (overrides inline) */
#trends h3.trend-tip { margin-top: 0 !important; }

/* Ensure extra space above the first trend header following the intro line */
#trends h3 + h3.trend-tip { margin-top: 25px !important; }
/* Optional: reduce top space before the first one */
#trends .trend-tip:first-of-type { margin-top: 140px !important; /* keep top offset */ }

/* Tooltip styling for barometer trend headers */
.trend-tip { position: relative; display: inline-block; cursor: help; }
.trend-tip .trend-tip-content {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 40px); /* shift pop-up an additional 20px lower */
  bottom: calc(100% + 10px);
  background: rgba(0,0,0,0.9);
  color: #eaeaea;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 12px 14px;
  width: min(520px, 92vw);
  font-size: 1rem; /* medium size */
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}

/* (no extra spacing above the intro header) */

.trend-tip:hover .trend-tip-content,
.trend-tip:focus-within .trend-tip-content {
  opacity: 1;
  visibility: visible;
}

.trend-tip .trend-tip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: rgba(0,0,0,0.9) transparent transparent transparent;
}


/* Additive spacing between consecutive trend headers (extra 50px) */
#trends .trend-tip + .trend-tip::before {
  content: "";
  display: block;
  height: 50px !important;
}

/* Additive 50px below "If the barometer is..." before the first trend header */
#trends .trend-tip:first-of-type::before {
  content: "";
  display: block;
  height: 100px !important; /* add 25px more above first trend header */
}

/* Color for the "If the barometer is..." header (the text is inside <em>) */
#trends h3 em { color: #7A93C7 !important; }

/* On hover, trend headers turn accent color */
#trends h3.trend-tip:hover,
#trends h3.trend-tip:focus { color: #7A93C7 !important; }

/* Normalize inner margins if any nested elements appear */
#trends h3.trend-tip * { margin: 0; }

/* Mobile header adjustments for records, almanac, and trends pages using this sheet */
@media (max-width: 600px) {
  /* Add space below city line */
  .logo-text .tagline:last-child { display: inline-block; padding-bottom: 10px; }

  /* Nav layout: center menu options */
  .main-nav { 
    width: 100%; 
    flex-direction: row; 
    align-items: center; 
    justify-content: center !important; 
  }
  .main-nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    justify-items: center;
    margin: 0 auto;
    padding: 0;
  }
  .main-nav ul li a { text-align: center; }
  .main-nav .menu-button { order: 2; margin-left: 12px; margin-bottom: 0; align-self: center; }
  .main-nav ul { order: 1; }
}

/* Maps page accordions - 85% viewport width, centered */
/* Only apply when maps-accordion exists in the weather section */
.weather-section:has(.maps-accordion) .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

/* Restore original container behavior for index.html weather section */
#weather .container {
  display: block !important;
  max-width: 1200px !important;
  width: auto !important;
}

/* Mobile: ensure container maintains proper width on mobile */
@media (max-width: 600px) {
  #weather .container {
    padding: 0 16px !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

.accordion.maps-accordion {
  width: 85vw !important;
  max-width: 85vw !important;
  margin: 14px auto !important; /* Reduced by 30% from 20px */
  display: block;
  box-sizing: border-box;
  position: relative;
  left: auto;
  right: auto;
}

/* Match accordion content height to display full iframe (845px + padding) */
.accordion.maps-accordion .accordion-checkbox:checked + .accordion-header + .accordion-content {
  max-height: 900px !important;
  overflow: visible;
}

/* Charts accordions - allow full iframe height, maintain aspect ratio */
.accordion.maps-accordion .accordion-content {
  text-align: center !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

.accordion.maps-accordion .accordion-content > div {
  width: 100% !important;
  text-align: center !important;
  display: block !important;
  margin: 0 auto !important;
  padding: 20px !important;
  box-sizing: border-box;
}

.accordion.maps-accordion .accordion-content iframe {
  width: 100% !important;
  border: none;
  display: block !important;
  margin: 0 auto !important;
}

/* Allow accordion content to expand to full iframe height (for charts page) */
/* This will accommodate different iframe heights when they're loaded */
.accordion.maps-accordion .accordion-checkbox:checked + .accordion-header + .accordion-content {
  max-height: 3000px !important; /* Large enough to accommodate varying iframe heights */
  overflow: visible;
}

/* Archive button styling - matches accordion header */
.archive-button {
  display: block !important;
  padding: 15px 20px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) !important;
  border: 1px solid rgba(199, 199, 199, 0.15) !important;
  border-left: 4px solid #7A93C7 !important;
  border-radius: 6px !important;
  color: #ffffff !important;
  font-size: 1.35rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
  text-align: center !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  width: 85vw !important;
  max-width: 85vw !important;
  margin: 14px auto !important;
}

.archive-button:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)) !important;
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Mobile: archive button full width */
@media (max-width: 768px) {
  .archive-button {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Mobile: MESOnet menu redesign - wheel picker below image */
@media (max-width: 768px) {
  /* Make container flex column to stack image and menu */
  .zoomable-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  /* Constrain image size on mobile */
  .zoomable-image {
    max-width: 100% !important;
    max-height: 50vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  /* Position menu below image instead of overlaying */
  .mesonet-menu-overlay {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: calc(100% - 40px) !important;
    min-width: auto !important;
    max-width: calc(100% - 40px) !important;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
  }

  /* Make submenu always visible and part of main list */
  .mesonet-menu-parent {
    position: static !important;
    padding: 0 !important;
    border-bottom: none !important;
    margin: 0 !important;
  }

  .mesonet-submenu {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    margin-left: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    min-width: auto !important;
    width: 100% !important;
    border: none !important;
    border-top: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 0;
    box-sizing: border-box;
  }

  /* Style as wheel picker - scrollable list */
  .mesonet-menu-list {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(199, 199, 199, 0.5) rgba(0, 0, 0, 0.2);
  }

  .mesonet-menu-list::-webkit-scrollbar {
    width: 8px;
  }

  .mesonet-menu-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
  }

  .mesonet-menu-list::-webkit-scrollbar-thumb {
    background: rgba(199, 199, 199, 0.5);
    border-radius: 4px;
  }

  .mesonet-menu-list::-webkit-scrollbar-thumb:hover {
    background: rgba(199, 199, 199, 0.7);
  }

  /* Wheel picker styling - larger touch targets */
  .mesonet-menu-list li {
    padding: 16px 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  }

  .mesonet-menu-item {
    font-size: 1.1rem !important;
    padding: 4px 0;
    display: block;
  }

  /* Submenu header styling */
  .mesonet-submenu-header {
    font-size: 1.1rem !important;
    padding: 16px 12px 12px 12px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3) !important;
  }

  .mesonet-submenu li {
    padding: 16px 12px !important;
    margin: 0 !important;
  }

  /* Remove hover effects on mobile - use active/touch instead */
  .mesonet-menu-item:not(.disabled):active,
  .mesonet-menu-item.hoverable:active {
    background: rgba(122, 147, 199, 0.2);
    color: #7A93C7;
  }

  /* Show "Other MCC Weather Stations" as section label on mobile */
  .mesonet-menu-parent > .mesonet-menu-item.hoverable {
    display: block !important;
    font-size: 1.1rem !important;
    font-weight: 700;
    color: #ffffff;
    padding: 4px 0;
  }

  /* Hide "Western Canada" submenu header */
  .mesonet-submenu-header {
    display: none !important;
  }

  /* Remove the hidden header row spacing entirely */
  .mesonet-submenu li.mesonet-submenu-header {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
  }

  /* Remove "mccwx.ca" from all menu items using content replacement */
  .mesonet-menu-item {
    font-size: 0 !important;
    position: relative;
  }

  .mesonet-menu-item::before {
    font-size: 1.1rem !important;
    display: block;
  }

  /* Keep section labels visible (not replaced by synthetic text) */
  .mesonet-menu-parent > .mesonet-menu-item.hoverable::before {
    content: none !important;
  }

  /* Specific replacements for each menu item */
  .mesonet-menu-list li:nth-child(1) .mesonet-menu-item::before {
    content: "Stn I • False Creek-Fairview";
  }

  .mesonet-menu-list li:nth-child(2) .mesonet-menu-item::before {
    content: "Stn II • Woodland-Clark Drive";
  }

  .mesonet-menu-list li:nth-child(3) .mesonet-menu-item::before {
    content: "Stn IV • South Van-Fraserview";
  }

  .mesonet-menu-list li:nth-child(4) .mesonet-menu-item::before {
    content: "Stn VI • Bowen Isl-Crayola";
  }

  .mesonet-menu-list li:nth-child(5) .mesonet-menu-item::before {
    content: "Stn VII • Dunbar-Southlands";
  }

  .mesonet-menu-list li:nth-child(6) .mesonet-menu-item::before {
    content: "Stn VIII • Surrey-Port Mann";
  }

  .mesonet-menu-list li:nth-child(7) .mesonet-menu-item::before {
    content: "Stn XI • West Van-Capilano";
  }

  /* Submenu items */
  .mesonet-submenu li:nth-child(2) .mesonet-menu-item::before {
    content: "Stn V • Sunshine Vly-Sumallo";
  }

  .mesonet-submenu li:nth-child(3) .mesonet-menu-item::before {
    content: "Stn X • Edmonton-Pylypow";
  }

  .mesonet-submenu li:nth-child(4) .mesonet-menu-item::before {
    content: "Stn XII • Calgary-Highland Park";
  }

  .mesonet-submenu li:nth-child(5) .mesonet-menu-item::before {
    content: "Stn XIII • Kelowna-YLW";
  }

  .mesonet-submenu li:nth-child(6) .mesonet-menu-item::before {
    content: "Stn XIV • Nelson-Gyro";
  }
}

/* Mobile: maps accordions full width on small screens */
@media (max-width: 768px) {
  .accordion.maps-accordion {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 14px 0;
    padding: 0;
  }
  
  /* Remove container padding on mobile for full-width accordions */
  .weather-section .container {
    padding: 0;
    width: 100%;
    max-width: 100%;
  }
  
  .accordion.maps-accordion .accordion-content {
    padding: 0 10px;
  }
  
  .accordion.maps-accordion .accordion-content > div {
    padding: 10px 5px;
  }
  
  .accordion.maps-accordion .accordion-content iframe {
    width: 100% !important;
    max-width: 100% !important;
    height: 634px; /* Decreased by 25% from 845px for mobile */
  }
  
  /* Match mobile accordion height to display full iframe */
  .accordion.maps-accordion .accordion-checkbox:checked + .accordion-header + .accordion-content {
    max-height: 680px !important; /* Adjusted to match reduced iframe height */
  }
}

/* --- Sticky alert ticker stack (index.html; miniWebUser) --- */
.alert-banner-stack {
  position: sticky;
  top: var(--alert-sticky-top, 88px);
  z-index: 950;
  width: 100%;
}

.alert-banner-stack[hidden] {
  display: none !important;
}

/* io2.html: fixed overlay layer; no sticky offset (see style2io.css). */
.alert-banner-stack--overlay {
  position: static;
  top: auto;
}

.alert-banner-stack .mcc-alert-source {
  display: none !important;
}

.alert-banner-stack > .alert-strip + .alert-strip {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.alert-strip {
  position: relative;
  top: auto;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  font-family: 'Comfortaa', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.alert-strip[hidden] {
  display: none !important;
}

.alert-marquee-viewport {
  width: 100%;
  overflow: hidden;
}

/* Short messages stay centred; wide ticker aligns start (see JS class toggles). */
.alert-marquee-viewport.alert-marquee-viewport--tight {
  text-align: center;
}

.alert-marquee-track {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  will-change: transform;
}

.alert-marquee-track--scroll {
  animation: alert-marquee-shift var(--alert-marquee-sec, 28s) linear infinite;
}

@keyframes alert-marquee-shift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.alert-marquee-chunk {
  flex: 0 0 auto;
  padding: 10px 56px 10px 16px;
  white-space: nowrap;
}

@media (min-width: 769px) {
  .alert-marquee-chunk {
    padding-left: 24px;
    padding-right: 64px;
  }
}

.alert-strip .alert-marquee-text,
.alert-strip .alert-marquee-dup,
.alert-strip #DP77 {
  display: inline;
  white-space: nowrap;
}

.alert-strip .alert-marquee-dup a,
.alert-strip .alert-marquee-text a,
.alert-strip #DP77 a {
  color: inherit;
  text-decoration: underline;
}

.alert-strip--grey {
  background: #5c5c5c;
  color: #f0f0f0;
}

.alert-strip--cyan {
  background: #00838f;
  color: #e8fdff;
}

.alert-strip--yellow {
  background: #e6c200;
  color: #1a1400;
}

.alert-strip--orange {
  background: #e65100;
  color: #fff8f5;
}

.alert-strip--red {
  background: #b71c1c;
  color: #fff5f5;
}

@media (prefers-reduced-motion: reduce) {
  .alert-marquee-track--scroll {
    animation: none !important;
  }

  .alert-marquee-viewport {
    display: flex;
    justify-content: center;
    text-align: center;
  }

  .alert-marquee-track {
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
  }

  .alert-marquee-chunk {
    white-space: normal;
    padding-left: 16px;
    padding-right: 16px;
  }

  .alert-strip .alert-marquee-text,
  .alert-strip .alert-marquee-dup,
  .alert-strip #DP77 {
    white-space: normal;
  }
}

