/* Phase 0 responsive and accessibility overrides.
   Loaded after style.css to avoid risky edits to the legacy theme. */

/* Restore visible keyboard focus where legacy CSS removes outlines. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #d5c196;
  outline-offset: 2px;
}

#left nav li a:focus-visible,
#content a:focus-visible {
  color: #ffffff;
  text-decoration: underline;
}

/* Utility class used to replace obsolete align attributes in legacy templates. */
.text-justify {
  text-align: justify;
}

/* Hidden on desktop; shown via media query below. */
.nav-toggle {
  display: none;
}

/* Ensure media scales down on narrow screens. */
img,
video,
object,
embed {
  max-width: 100%;
  height: auto;
}

/* Background slideshow images are position:fixed and sized by JS to be intentionally
   wider than the viewport — max-width:100% would clamp them incorrectly. */
img[style*="position: fixed"] {
  max-width: none;
}

/* Tablet and below */
@media (max-width: 1024px) {
  #left {
    position: relative;
    width: 100%;
    min-height: 0;
    height: auto;
    z-index: 10;
  }

  #left #logo {
    width: auto;
    margin: 20px 0 10px;
  }

  /* Hide nav by default; shown when #left.nav-open is toggled by the hamburger button. */
  #left nav {
    display: none;
    float: none;
    margin: 10px 20px 20px;
    text-align: left;
    white-space: normal;
    font-size: 18px;
    line-height: 1.4;
  }

  #left.nav-open nav {
    display: block !important;
  }

  .nav-toggle {
    display: block;
    background: none;
    border: 1px solid #7A6F63;
    color: #7A6F63;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 16px;
    padding: 8px 16px;
    margin: 16px 20px 8px;
    width: calc(100% - 40px);
    text-align: left;
    cursor: pointer;
    letter-spacing: 0.05em;
  }

  .nav-toggle:hover,
  .nav-toggle:focus-visible {
    color: #fff;
    border-color: #fff;
  }

  #left nav li:hover {
    background: none;
  }

  #left nav li > ul {
    position: static;
    left: auto;
    top: auto;
    min-height: 0;
    height: auto;
    /* Override royale.js inline display:none so submenus are always visible on mobile. */
    display: block !important;
    visibility: visible;
    margin-left: 14px;
    border-left: 1px solid #2b2b2b;
  }

  /* royale.js sets a large inline margin-top on the first submenu item for desktop flyout
     alignment — zero it out on mobile where submenus stack inline. */
  #left nav li > ul > li:first-child {
    margin-top: 0 !important;
  }

  #content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    min-height: 0;
    margin-left: 0 !important;
  }

  #content #container {
    padding: 0 16px;
  }

  #content #social {
    float: none;
    margin: 12px 16px;
  }

  /* Enlarge background slideshow touch targets to ~44px */
  #bg-slideshow #gallery-buttons .prev-next,
  #bg-slideshow #gallery-buttons #play-pause {
    padding: 12px;
  }
}

/* Narrow tablet / large phone: collapse all grid columns to single column */
@media (max-width: 640px) {
  #content #container article section.one-third,
  #content #container article section.one-fourth,
  #content #container article section.one-fifth,
  #content #container article section.one-half,
  #content #container article section.two-thirds,
  #content #container article section.full-width,
  #content footer section.one-third,
  #content footer section.one-fourth,
  #content footer section.one-fifth,
  #content footer section.one-half,
  #content footer section.two-thirds,
  #content footer section.full-width {
    width: 100%;
    float: none;
    clear: both;
    margin-left: 0;
  }

  /* News/reviews: stack thumbnail above text */
  #content #container #blog section.blog-thumb,
  #content #container #blog section.blog-post,
  #content #container .news section.blog-post,
  #content #container .news-single section.blog-post {
    width: 100%;
    float: none;
    clear: both;
    margin-left: 0;
  }

  /* Blog single: remove fixed width */
  #content #container .blog-single section {
    width: 100%;
    float: none;
  }
}

/* Mobile */
@media (max-width: 480px) {
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  #left nav {
    font-size: 16px;
    margin: 8px 12px 14px;
  }

  #left nav li a {
    margin: 0;
    padding: 4px 0;
  }

  #content header {
    margin-top: 16px;
    line-height: 1.2;
  }

  #content h1 {
    font-size: 34px;
    line-height: 1.15;
  }

  #content h2 {
    font-size: 24px;
    line-height: 1.25;
  }

  #content h3 {
    font-size: 20px;
    line-height: 1.3;
  }

  #content #container {
    padding: 0 12px;
  }
}

