/* ============================================================
   toursnew.css — BAWSCA Garden Tours (Foundation/jQuery/Spry-free)
   ============================================================ */

/* --- Baseline --- */
*, *::before, *::after { box-sizing: border-box; }

/* The header is position:fixed, so anything scrolled into view - keyboard focus,
   the skip-link target, any in-page anchor - would land underneath it. Reserving
   the header's height here keeps the focus indicator visible.
   WCAG 2.2 SC 2.4.11 Focus Not Obscured (Minimum), Level AA. */
html { scroll-padding-top: 75px; }

body {
  margin: 0;
  padding-top: 59px;
  background-color: #fafafa;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  color: #545454;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: #1779ba;         /* was olive green - brought onto the nav palette */
  color: #fefefe;
  padding: 0.6rem 1rem;
  z-index: 200;
  text-decoration: underline;
  font-weight: bold;
  font-family: 'Open Sans', sans-serif;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #0a0a0a;
  outline-offset: 2px;
}

/* ============================================================
   Fixed site header
   ============================================================ */
/* Navigation palette matches contracosta.watersavingplants.com:
     bar        #fff        links/caret  #1779ba
     submenu    #fff, 1px solid #cacaca
     active/hover fill #1779ba with #fefefe text
     mobile bar #0a0a0a with #fefefe (ContraCosta's .title-bar)
   ContraCosta puts no border or shadow under its bar, so neither do we. */
.site-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 99;
  background: #fff;
}

.site-header nav {
  display: flex;
  align-items: stretch;
  max-width: 75rem;
  margin: 0 auto;
  position: relative;
}

/* --- Hamburger (mobile only) --- */
.hamburger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.6rem 1rem;
  color: #fefefe;              /* sits on the dark mobile bar */
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  align-items: center;
  gap: 0.5rem;
  line-height: 1;
}

.hamburger:focus {
  outline: 3px solid #fefefe;
  outline-offset: -3px;
}

.hamburger-bars {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  position: relative;
  flex-shrink: 0;
}
.hamburger-bars::before,
.hamburger-bars::after {
  content: '';
  display: block;
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
}
.hamburger-bars::before { top: -6px; }
.hamburger-bars::after  { top:  6px; }

/* --- Nav menu --- */
.nav-menu {
  list-style: none;
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
  flex: 1;
}

.nav-menu > li {
  position: relative;
  display: flex;
  align-items: stretch;
}

/* Plain links and toggle buttons share the same look */
.nav-menu > li > a,
.nav-menu > li > .nav-toggle {
  display: flex;
  align-items: center;
  height: 55px;
  /* 1em = 16px here, so the 16px side padding matches ContraCosta exactly
     and the gaps between items come out the same. */
  padding: 0 1em;
  color: #1779ba;
  /* Type matches ContraCosta's measured nav links: Open Sans 16px / 400,
     no letter-spacing, no uppercase, line-height 1. */
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  word-spacing: normal;
  line-height: 1;
  text-transform: none;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

/* Three separate states, deliberately given three different treatments.
   They used to share a single rule, which meant the current page, an open
   submenu and whatever was under the pointer all painted the same solid blue
   and stacked up - Home stayed lit while Gardens was open, and both stayed lit
   while the pointer was over Plants.

     hover / focus  light tint      "you could click this"
     open           solid fill      "this menu is open" (joins the panel below)
     current page   underline bar   "you are here"                             */

/* 1. Hover - excluded on the open item so the fill below still wins there. */
.nav-menu > li > a:hover,
.nav-menu > li > .nav-toggle:not([aria-expanded="true"]):hover {
  background: #eaf3f9;
  color: #12608f;                        /* 6.04:1 on the tint */
}

/* 2. Current page - a marker rather than a fill, so it never competes with an
      open menu. Bold as well as coloured, so the cue is not carried by colour
      alone (WCAG 1.4.1). The bar is an inset shadow rather than a border so it
      does not change the 55px row height. */
.nav-menu > li > a[aria-current] {
  color: #1779ba;                        /* 4.69:1 on white */
  font-weight: 600;
  box-shadow: inset 0 -3px 0 #1779ba;
}

.nav-menu > li > a[aria-current]:hover {
  background: #eaf3f9;
  color: #12608f;
  box-shadow: inset 0 -3px 0 #12608f;
}

/* 3. Open submenu - last, so it beats hover on the same button. */
.nav-menu > li > .nav-toggle[aria-expanded="true"] {
  background: #1779ba;
  color: #fefefe;                        /* 4.65:1 */
}

/* A white ring would be invisible on the white bar (WCAG 1.4.11) */
.nav-menu > li > a:focus,
.nav-menu > li > .nav-toggle:focus {
  outline: 3px solid #1779ba;
  outline-offset: -3px;
}

/* Arrow indicator on toggle buttons */
.nav-toggle::after {
  content: ' \25be';
  font-size: 0.9em;
  margin-left: 0.3em;
}

/* --- Submenus --- */
.nav-submenu {
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #cacaca;
  z-index: 200;
  margin: 0;
  padding: 0;
}

.nav-submenu[hidden] { display: none; }

/* ContraCosta's submenu links carry the same type as the top-level ones,
   with 11.2px / 16px padding (0.7rem 1rem). */
.nav-submenu li a {
  display: block;
  padding: 0.7rem 1rem;
  color: #1779ba;
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  word-spacing: normal;
  line-height: 1;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
}

/* Same three-way distinction one level down. Previously the current page and a
   hovered sibling both filled solid blue, so on tours.php "Tours" and whatever
   the pointer was over looked identical. */

/* Current page - a fill reads well inside a dropdown list */
.nav-submenu li a[aria-current] {
  background: #1779ba;
  color: #fefefe;
}

/* Hovering any other item gets the lighter tint instead */
.nav-submenu li a:hover {
  background: #eaf3f9;
  color: #12608f;
}

/* Hovering the current item deepens its fill rather than switching to the tint */
.nav-submenu li a[aria-current]:hover {
  background: #12608f;
  color: #fefefe;                        /* 6.73:1 */
}

.nav-submenu li a:focus {
  outline: 3px solid #1779ba;
  outline-offset: -3px;
}

/* ============================================================
   Page content
   ============================================================ */
/* Full browser width, like the ContraCosta "#content" block (20px side margins) */
.page-wrap {
  margin: 0 auto;
  padding: 1.5rem 20px 3rem;
}

/* Matches the ContraCosta ".title" treatment: left aligned, dashed rule beneath */
.page-wrap h1 {
  text-align: left;
  font-size: 1.3em;
  color: #545454;
  margin: 0.5em 0 1.5rem;
  padding-bottom: 5px;
  border-bottom: #545454 dashed 1px;
  font-weight: 700;
  font-family: 'Open Sans', sans-serif;
}

/* ============================================================
   Thumbnail grid
   ============================================================ */
/* Cards stay a fixed 307px wide (the photos are 300x300, so stretching them
   would just blur); the browser fits as many across as the window allows -
   4, 5, 6 or more on a wide monitor. Same behaviour as the floated thumbnails
   on ContraCosta, which fill the width and wrap.
   The min() keeps a single card from overflowing very narrow windows. */
.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, min(100%, 307px));
  gap: 1.25rem 24px;
  justify-content: start;
}

.tour-card {
  background: #fff;
}

.tour-card a.thumb-link {
  display: block;
  overflow: hidden;
}

/* ContraCosta uses fixed 307 x 301 thumbnails; the same ratio is kept here so the
   cards line up in a tidy grid at any width. */
.tour-card a.thumb-link img {
  width: 100%;
  aspect-ratio: 307 / 301;
  height: auto;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.tour-card a.thumb-link:hover img,
.tour-card a.thumb-link:focus img {
  opacity: 0.85;
}

.tour-card a.thumb-link:focus {
  outline: 3px solid #0078c0;
  outline-offset: 2px;
}

/* Matches the ContraCosta ".thumbbutt" caption bar */
.tour-card .caption {
  display: block;
  text-align: left;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  padding: 5px 8px 8px;
}

.tour-card .caption a {
  display: block;
  color: #666;
  font-size: 0.85em;
  font-family: 'Open Sans', sans-serif;
  text-decoration: none;
}

.tour-card .caption a:hover {
  color: #0078c0;
}

.tour-card .caption a:focus {
  outline: 3px solid #0078c0;
  outline-offset: 2px;
}

/* --- Footer --- */
#footer {
  text-align: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75em;
  color: #666;
  padding: 2rem 0 1rem;
}

/* Underlined so the link is not identified by colour alone - it sits inside a run
   of #666 text and the two colours differ by only 1.22:1.
   WCAG SC 1.4.1 Use of Color, Level A. */
#footer a {
  color: #0078c0;
  text-decoration: underline;
}

/* ============================================================
   Mobile  (< 640px)
   ============================================================ */
@media screen and (max-width: 39.9375em) {

  body { padding-top: 3rem; }

  .hamburger { display: flex; }

  /* ContraCosta keeps a dark bar on mobile (its .title-bar) even though the
     desktop bar is white, so the hamburger row goes dark here too. */
  .site-header { background: #0a0a0a; }

  .nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #cacaca;
    border-bottom: 1px solid #cacaca;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu.is-open { display: flex; }

  .nav-menu > li { display: block; }

  .nav-menu > li > a,
  .nav-menu > li > .nav-toggle {
    height: auto;
    width: 100%;
    padding: 0.75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid #cacaca;
    justify-content: space-between;
  }

  .nav-submenu {
    position: static;
    border: 0;
    min-width: 0;
  }

  .nav-submenu li a { padding-left: 2rem; }

  /* Header is shorter on mobile, so less needs reserving */
  html { scroll-padding-top: 54px; }

  .page-wrap { padding-left: 12px; padding-right: 12px; }

  .tour-grid { justify-content: center; }
}

/* The tour grid needs no other breakpoints - auto-fill works out the
   column count at every width on its own. */
