/* Get updates: quiet outlined control under the brand, badge in the hero.
   Navbar geometry (from main.css / Bootstrap 3):
   - .navbar min-height 50px, 1px bottom border
   - desktop (>=768px) .navbar-custom padding 20px 0 → 91px expanded bar
   - desktop .intro-header.big-img margin-top 91px; .intro-header 130px
     (130 − 91 = 39px clearance for the centred 100px avatar)
   - desktop .intro-header.big-img .page-heading padding 50px 0
   - mobile .intro-header.big-img margin-top 51px; page-heading padding 30px 0
   The desktop button sits under the brand, so the bar grows by the button row.
   --thw-updates-row is that extra height; intro-header margins are shifted by it.
*/
:root {
  --thw-updates-row: 32px; /* 4px gap + 24px control (5+12+5 pad, 12px type, 2px border) + 4px below */
}

.nav-updates,
.updates-badge-wrap {
  position: relative;
}

/* --- Desktop button under the brand ------------------------------------- */
.updates-button,
.random-button {
  display: inline-block;
  cursor: pointer;
  margin: 0;
  background: transparent;
  color: #9a3b3b !important;
  border: 1px solid #9a3b3b;
  border-radius: 3px;
  padding: 5px 12px;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none !important;
  line-height: 1;
  white-space: nowrap;
}
.updates-button:hover,
.updates-button:focus,
.random-button:hover,
.random-button:focus {
  background: #f3eaea;
  color: #9a3b3b !important;
}

@media only screen and (min-width: 768px) {
  .navbar-custom .nav-updates-desktop {
    /* Header sits at the container's 15px inset; .navbar-brand uses margin-left: -15px
       plus 15px padding, so the title text starts at x=15. No extra pad here, so the
       button's left edge matches the title. line-height/flex avoids a text-strut gap. */
    display: flex;
    clear: both;
    position: relative;
    padding: 4px 0;
    line-height: 1;
    align-items: flex-start;
    gap: 8px;
    /* The row hangs under the brand without widening the floated header, otherwise
       brand + buttons + nav links no longer fit on one line at 768-822px and the menu wraps. */
    width: 0;
    white-space: nowrap;
  }
  .navbar-custom .nav-updates-mobile,
  .navbar-custom .nav-random-mobile {
    display: none !important;
  }

  /* Shift hero/page titles below the taller bar; keep the 39px avatar clearance on no-img pages */
  .intro-header {
    margin-top: calc(130px + var(--thw-updates-row));
  }
  .intro-header.big-img {
    margin-top: calc(91px + var(--thw-updates-row));
  }
}

@media only screen and (max-width: 767px) {
  .navbar-custom .nav-updates-desktop {
    display: none !important;
  }
  .navbar-custom .nav-updates-mobile,
  .navbar-custom .nav-random-mobile {
    display: list-item;
  }
  /* 44px minimum tap target for every row of the open menu (Bootstrap default is 40px) */
  .navbar-custom .navbar-nav > li > a {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* The 50px avatar hangs below the 51px navbar (image to ~75px, shadow to ~82px).
     no-img titles started at 50px and sat under the avatar. Push them clear,
     leaving a gap similar to story pages on desktop. Homepage hero (big-img)
     and the <=365px homepage title-under-image fallback are left unchanged. */
  .intro-header.no-img {
    margin-top: 96px;
  }
  .header-section.has-img .intro-header.no-img {
    margin-top: 0;
  }
}

/* Mobile: ordinary item in the collapsed menu (inherits .navbar-custom .nav li a) */
.updates-menu-link {
  display: block;
}

/* --- Hero badge (homepage big-img only) --------------------------------- */
.updates-badge-wrap {
  position: absolute;
  /* Level with the top of the big title (desktop page-heading padding is 50px) */
  top: 50px;
  /* Same 15px left edge as the brand text and nav button */
  left: 15px;
  z-index: 10;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.updates-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.85);
  color: #9a3b3b;
  /* 2x the original pill (was 1px border, 20px radius, 6px 14px pad, 12px type, 1px spacing) */
  border: 2px solid #9a3b3b;
  border-radius: 40px;
  padding: 12px 28px;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.updates-badge:hover,
.updates-badge:focus {
  background: #fff;
  color: #9a3b3b;
  text-decoration: none;
}

/* Narrow and tablet widths (<1024px): the centred 70px title reaches within ~100px of the
   left edge, so a title-level pill at the left covers "The" (it overlapped at 768-~950px).
   Sit the pill in the strip of image below the subtitle instead. */
@media only screen and (max-width: 1023px) {
  .updates-badge-wrap {
    top: auto;
    bottom: 6px;
    left: 15px;
  }
  .updates-badge {
    /* 2x the old mobile pill (was 4px 10px pad, 11px type, 1px border) */
    padding: 8px 20px;
    font-size: 22px;
    letter-spacing: 2px;
    border-width: 2px;
  }
  /* Tablet: the heading already has 50px bottom padding; add just enough for the pill */
  .intro-header.big-img {
    padding-bottom: 40px;
  }
  .updates-badge-wrap .updates-panel {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
  }
}

@media only screen and (max-width: 767px) {
  /* Phones: the heading padding is only 30px, so make room below the subtitle */
  .intro-header.big-img {
    padding-bottom: 72px;
  }
  /* Bootstrap caps .navbar-collapse at 340px; the in-flow panel would be clipped. */
  .navbar-custom .navbar-collapse.in {
    max-height: none;
    overflow: visible;
  }
}

/* --- Dropdown panel ------------------------------------------------------ */
.updates-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 0;
  min-width: 200px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1050;
}
.updates-panel.is-open {
  display: block;
}
.updates-panel a,
.navbar-custom .nav .updates-panel a {
  display: block;
  padding: 6px 14px;
  color: #333;
  text-decoration: none;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: none;
  line-height: 1.4;
  white-space: nowrap;
}
.updates-panel a:hover,
.updates-panel a:focus {
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
}

@media only screen and (max-width: 767px) {
  /* Keep the menu-item panel in flow so the collapsing navbar does not clip it */
  .nav-updates-mobile .updates-panel {
    position: static;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #f5f5f5;
    min-width: 0;
  }
}
