/* Import Pure CSS responsive grids if not already included in HTML */
@import url('https://unpkg.com/purecss@3.0.0/build/grids-responsive-min.css');

/* Prevent horizontal scrollbars and stabilize sizing */
html, body {
  overflow-x: hidden;
  height: 100%;
  scroll-behavior: smooth;
}

/* Green Links: for non-existent pages on temporary web site */
.green-link {
  color: green;
  text-decoration: underline;
}

/* Background and structure - working with Pure's defaults */
body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  background-color: #f7f7f7;
  color: #333;
  line-height: 1.6;
}

/* Enhanced Navigation using Pure's menu structure */
.topnav {
    background-color: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.10);
    text-align: center;
    position: relative;
}

/* Logo styling for top navigation */
.logo-container {
  text-align: center;
  margin-bottom: 10px;
}

.site-logo {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto;
}

/* Ensure the top-tier centers its content */
.top-tier {
  text-align: center;
}

.top-tier {
    padding: 0.5em 0;
    border-bottom: 1px solid #eee;
}

.top-tier .brand-link {
    font-size: 1.5em;
    color: #003975;
    text-decoration: none;
    font-weight: bold;
    padding: 0.5em;
    display: inline-block;
}

.brand-link:hover,
.brand-link:focus {
    background-color: #f56505;
    color: white;
    border-radius: 4px;
}

/* Use Pure's menu classes properly */
.second-tier {
    padding: 0.5em 0;
}

.menu-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
}

.menu-list li {
    display: inline-block;
}

/* Enhanced menu links with Pure CSS patterns */
.pure-menu-link {
    color: #003975;
    text-decoration: none;
    padding: 0.5em 1em;
    display: block;
    white-space: nowrap;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pure-menu-link:hover,
.pure-menu-link:focus {
    background-color: #f56505;
    color: white;
}

/* Header using Pure's grid system properly */
.header-row {
  margin-top: 1em;
  padding: 0 1em;
}

/* Enhance Pure's grid units */
.site-header {
  padding: 0 0.5em;
}

.left-header,
.right-header {
  background-color: #fcfcfc;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1em;
  box-sizing: border-box;
  margin-bottom: 1em;
}

.quotation {
    text-align: justify;
    padding: 0 1em;
    font-size: 0.9em;
}

/* --- Main Section Background (after quotes) --- */
.main-section {
  background-color: #fcfcfc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 2em;
  padding-bottom: 0;
  box-sizing: border-box;
}

.viewing-advice {
  text-align: center;
}

/* ============================================
   DEVICE ADVICE CARD (mobile only)
   ============================================ */

.viewing-advice {
  display: none; /* hidden by default on desktops */
  text-align: center;
  margin: 1.5em 0 2em 0;
}

.device-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;

  padding: 1em 1.5em;
  background: #eef3f8;
  border: 1px solid #d6dde6;
  border-radius: 14px;

  max-width: 420px;
  margin: 0 auto;

  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.device-icon {
  width: 48px;
  height: 48px;
  opacity: 0.9;
}

.device-text {
  font-size: 0.9em;
  margin: 0;
  color: #003975;
  font-weight: 600;
}

.device-attribution {
  font-size: 0.7em;
  margin: 0;
  color: #777;
}


@media screen and (max-width: 64em) {
  .viewing-advice {
    display: block;
  }
}


/* ============================================
   EXTRAS CONTAINER - Wide, breathing room
   For videos, images, galleries, etc.
   ============================================ */
.extras-container {
  max-width: 100%;                    /* Full width available */
  margin: 0 auto 0.5em auto;          /* Reduced from 1.5em to 0.5em bottom spacing */
  padding: 0 1em;                     /* Base padding (mobile) */
  box-sizing: border-box;
  background: transparent;
}

.extras-container h3 {
  text-align: center;
  margin-bottom: 1.5em;
  font-size: 1.3em;
  color: #333;
}

/* Remove underlines from links in extras container */
.extras-container a {
  text-decoration: none;
}

/* Optional: Add underline on hover for better UX */
.extras-container a:hover,
.extras-container a:focus {
  text-decoration: underline;
}

/* Grid for extras content - stabilized width */
.extras-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  /* Use percentage-safe margins to prevent narrowing on complex pages */
  margin: 2em 0;
  width: 100%;
  box-sizing: border-box;
}

/* Individual extras items */
.extras-item {
  text-align: center;
  /* Use a consistent box-sizing and width assurance */
  padding: 0 1em;
  margin-bottom: 2em;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;  /* ← ADD THIS - prevents shrinking */
}

/* Ensure full-width items actually touch the edges of the grid */
.pure-u-1.extras-item {
  width: 100%;
}

/* Media elements inside extras */
.extras-item video,
.extras-item img {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  border: 1px solid #000000;  /* Add border */
}

.extras-item figure {
  margin: 0;
}

.extras-item figcaption {
  margin-bottom: 1em;
  font-size: 0.9em;
  color: #555;
}

/* Vertical alignment options for grid items */
.extras-item.align-bottom {
  align-self: flex-end;
}

.extras-item.align-center {
  align-self: center;
}

.extras-item.align-top {
  align-self: flex-start;
}

/* ============================================
   TEXT BOXES - Bordered containers for text
   Like thumbnails but for text content
   ============================================ */

/* Basic text box with border */
.text-box {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 1.5em;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 100%;              /* Fill the grid item height */
  max-width: 100%; /* make boxes expand to full width, regardless of content */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.text-box h4 {
  margin: 0 0 0.75em 0;
  color: #003975;
  font-size: 1.2em;
  font-weight: 600;
  text-align: left;
}

/* Remove underlines from links in extras container */
/* For text box links */
.text-box a,
.text-box-link {
  text-decoration: none;
}

.text-box p {
  margin: 0;
  color: #555;
  text-align: left;
  line-height: 1.5;
  flex: 1;                   /* Allow text to grow and fill space */
}

.text-box ul,
.text-box ol {
  margin: 0;
  padding-left: 1.5em;
  color: #555;
  text-align: left;
}

/* Hover effect */
.text-box:hover {
  border-color: #f56505;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Clickable text boxes */
.text-box-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.text-box-link .text-box {
  cursor: pointer;
}

.text-box-link:hover .text-box {
  border-color: #f56505;
  background-color: #f9f9f9;
}

/* Text box variations */
.text-box.featured {
  border: 3px solid #f56505;
  background-color: #fff9f5;
  border-radius: 12px;
}

.text-box.compact {
  padding: 1em;
}

.text-box.compact h4 {
  font-size: 1em;
  margin-bottom: 0.5em;
}

.text-box.compact p {
  font-size: 0.9em;
}

/* Color scheme variations */
.text-box.blue {
  border-color: #003975;
  background-color: #f0f5ff;
}

.text-box.orange {
  border-color: #f56505;
  background-color: #fff5f0;
}

.text-box.gray {
  border-color: #999;
  background-color: #f9f9f9;
}

/* Accent border (left side) */
.text-box.accent {
  border-left: 4px solid #f56505;
}



/* ============================================
   TEXT CONTAINER - Centered, comfortable reading
   For main text content only
   ============================================ */
.text-container {
  max-width: 56em;                   /* Comfortable reading width */
  margin: 0.5em auto 2em auto;       /* Reduced top from 1.5em to 0.5em */
  padding: 2em;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  flex: 1 0 auto;
}

/* Typography following Pure CSS patterns */
h1, h2 {
  text-align: center;
  font-weight: bold;
  color: #333;
  margin: 1em 0 0.5em 0;
}

h3 {
  text-align: center;
  font-weight: 300;
  color: #333;
  margin: 1em 0 0.5em 0;
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.17em; }

p {
  line-height: 1.6;
  margin: 0 0 1em 0;
}

/* for highlighted links <span />    */
:target {
  font-weight: bold;
  color: #d35400;
  background-color: #fef9e7;
}

.typewriter-box {
  background-color: #000;
  color: #fff;
  font-family: "Courier New", Courier, monospace;
  font-size: 1.2em;
  padding: 20px;
  border-radius: 10px;
  margin: 1.5em 0;
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Images following Pure's responsive image pattern */
img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin-top: 1em;
}

.next-page-btn {
  display: inline-block;
  margin-top: 2em;
}

/* Next Page Button */
.next-page-btn {
    width: 100px;
    height: 40px;
    background-color: #f56505;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.next-page-btn:hover,
.next-page-btn:focus {
    background-color: #003975;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: white;
}

.next-page-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Footer using Pure's approach #f5f5f5  #e6e6e6*/
.site-footer {
  background-color: #f5f5f5;
  text-align: center;
  padding: 2em 1em;
  font-size: 1em;
  color: #555;
  flex: 0 0 auto;
  width: 100%;
  margin-top: auto;
}

.ticker-control {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1em;
    font-size: 0.9em;
}

.ticker-control input[type="range"] {
    margin-left: 0.5em;
}

.ticker-wrap {
    overflow: hidden;
    overflow-x: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    position: relative;
    font-family: 'Courier Prime', Courier, Arial, sans-serif;
    font-weight: 900;
    font-size: 0.8em;
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5em 0;
}

.ticker {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 20s linear infinite;
}

.ticker-heading {
    color: #343536;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.ticker a {
    padding: 0 1em;
    color: #353738;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.ticker a:hover,
.ticker a:focus {
    background-color: #f56505;
    color: white;
}

.copyNotice {
    font-size: 0.7em;
    color: #666;
    margin-top: 1em;
}

/* Ticker Animation */
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


/* ============================================
   QGIS/LEAFLET MAP IFRAME STYLING
   Add this to your styles.css
   ============================================ */

/* QGIS Map iframe container */
.qgis-map-container {
  width: 100%;
  height: 600px;
  margin: 2em 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  background-color: #f0f0f0;
  position: relative;
}

.qgis-map-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Height variations */
.qgis-map-container.compact {
  height: 400px;
}

.qgis-map-container.tall {
  height: 800px;
}

.qgis-map-container.full-height {
  height: 90vh;
}

/* In extras container - ensure full width */
.extras-container .qgis-map-container {
  max-width: 100%;
}

/* In text container - matches content width */
.text-container .qgis-map-container {
  max-width: 100%;
}

/* Loading state - optional visual feedback */
.qgis-map-container::before {
  content: 'Loading map...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 1.1em;
  z-index: 1;
  pointer-events: none;
}

.qgis-map-container iframe:not([src=""]) + ::before {
  display: none;
}

/* Mobile responsiveness */
@media screen and (max-width: 35.5em) {
  .qgis-map-container {
    height: 400px;
    margin: 1em 0;
    border-radius: 8px;
  }

  .qgis-map-container.tall {
    height: 500px;
  }

  .qgis-map-container.full-height {
    height: 70vh;
  }
}

/* Tablet adjustments */
@media screen and (min-width: 35.5em) and (max-width: 48em) {
  .qgis-map-container {
    height: 500px;
  }

  .qgis-map-container.tall {
    height: 650px;
  }
}

/* Print styles - hide maps in print */
@media print {
  .qgis-map-container {
    display: none;
  }

  .qgis-map-container::after {
    content: '[Interactive map - view online]';
    display: block;
    padding: 2em;
    border: 2px dashed #ccc;
    text-align: center;
    color: #666;
  }
}




/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Pure's sm breakpoint: 35.5em (568px) - MOBILE */
@media screen and (max-width: 35.5em) {
    body {
        font-size: 0.9em;
    }

    .brand-link {
        font-size: 1.3em;
    }

    .menu-list {
        flex-direction: column;
        gap: 0.25em;
    }

    .pure-menu-link {
        padding: 0.75em 1em;
        font-size: 0.9em;
        margin: 0.1em;
    }

    .quotation {
        text-align: left;
        padding: 0 0.5em;
        font-size: 0.85em;
    }

    /* Text container on mobile */
    .text-container {
        margin: 1em 0.5em;
        padding: 1em;
        border-radius: 0;
    }

    /* Extras container on mobile - minimal padding */
    .extras-container {
        padding: 0 0.5em;
        margin-bottom: 2em;
    }

    .ticker-wrap {
        font-size: 0.75em;
    }

    .ticker-control {
        flex-direction: column;
        gap: 0.5em;
    }
}

/* Responsive stacking for Extras Grid - applies to mobile AND tablet */
@media screen and (max-width: 48em) {
    .extras-grid {
        margin: 1em 0;
    }

    .extras-item {
        flex: 1 1 100%;
        max-width: 100%;
        padding: 0 1em;
        margin-bottom: 1.5em;
        box-sizing: border-box;
    }

    .extras-item .text-box {
        width: 100%;
    }
}

/* Pure's md breakpoint: 48em (768px) - TABLET */
@media screen and (min-width: 35.5em) and (max-width: 48em) {
    /* existing tablet-specific rules */
}

/* Pure's md breakpoint: 48em (768px) - TABLET */
@media screen and (min-width: 35.5em) and (max-width: 48em) {
    .quotation {
        font-size: 0.95em;
    }

    .pure-menu-link {
        padding: 0.6em 0.8em;
    }

    /* Extras container on tablets */
    .extras-container {
        padding: 0 1.5em;
    }

    .ticker-wrap {
        font-size: 0.85em;
    }
}

/* Pure's lg breakpoint: 64em (1024px) - DESKTOP */
@media screen and (min-width: 48em) and (max-width: 64em) {
    body {
        font-size: 1.05em;
    }

    .quotation {
        padding: 0 2em;
    }

    /* Extras container matches quotation padding */
    .extras-container {
        padding: 0 2em;
    }
}

/* Pure's xl breakpoint: 80em (1280px) and above - LARGE DESKTOP */
@media screen and (min-width: 64em) {
    body {
        font-size: 1.1em;
    }

    .quotation {
        padding: 0 3em;
    }

    /* Extras container matches quotation padding */
    .extras-container {
        padding: 0 3em;
    }

    .text-container {
        padding: 2.5em;
    }

    .ticker-wrap {
        font-size: 0.9em;
    }
}

/* Enhanced accessibility following Pure CSS patterns */
.pure-menu-link:focus,
.brand-link:focus {
    outline: 2px solid #f56505;
    outline-offset: 2px;
}

/* Print styles following Pure CSS approach */
@media print {
    .topnav,
    .site-footer {
        display: none;
    }

    .text-container {
        box-shadow: none;
        border: none;
        background: #fff;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .extras-container {
        padding: 0;
    }

    body {
        font-size: 12pt;
        color: #000;
    }
}

/* --- Social bar: stabilize hover (no layout shift) --- */
.social-link { 
    position: relative; 
}

/* Convert the label into a tooltip positioned above the icon */
.social-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) scale(0.98);
    opacity: 0;
    max-width: none;
    margin-left: 0;
    pointer-events: none;
    white-space: nowrap;
    background: #333;
    color: #fff;
    padding: 0.25em 0.5em;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.social-link:hover .social-label,
.social-link:focus .social-label,
.social-link:focus-within .social-label {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.social-label::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}
