/* ==========================================================================
   Phase A: Responsive overrides for rewana.com
   Loaded after reset.css, rewana.css, and landing.css
   ========================================================================== */

/* --- A2: Global fluid foundations --- */

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

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

#container {
  height: auto;
  min-height: 0;
}

#frame {
  height: auto;
}

#main-content {
  height: auto;
}

#content {
  min-height: 0;
}

dl {
  width: auto;
  height: auto;
}

dt {
  height: auto;
}

dd {
  height: auto;
}


/* --- A3: Nav toggle button (hidden on desktop) --- */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #333;
  padding: 10px 15px;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background-color: transparent;
  border-radius: 4px;
}


/* ==========================================================================
   Tablet and below (<=1024px)
   ========================================================================== */

@media screen and (max-width: 1024px) {

  /* --- A10: Replace three-band background with center band color --- */
  body {
    background-image: none;
    background-color: #ebf5ff;
  }

  #index div#container {
    background-image: none;
  }

  /* --- A3: Show hamburger, off-canvas nav --- */
  .nav-toggle {
    display: block;
  }

  #main-nav {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background-color: #e3e3e3;
    z-index: 999;
    padding-top: 70px;
    padding-left: 20px;
    margin-left: 0;
    float: none;
    overflow-y: auto;
    transition: left 0.3s ease;
  }

  #main-nav.is-open {
    left: 0;
  }

  /* Override landing.css #container #main-nav specificity */
  #container #main-nav {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    float: none;
    margin-left: 0;
    padding-top: 70px;
    padding-left: 20px;
    background-color: #e3e3e3;
    z-index: 999;
    overflow-y: auto;
    transition: left 0.3s ease;
  }

  #container #main-nav.is-open {
    left: 0;
  }

  #main-nav h1 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  /* Overlay behind open nav */
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 998;
  }

  .nav-overlay.is-visible {
    display: block;
  }

  /* --- A4: Main layout stacking --- */
  #frame {
    width: 100%;
    float: none;
    margin-left: 0;
  }

  #container {
    width: 100%;
    padding-left: 0;
  }

  #index div#container {
    padding-left: 0;
  }

  /* Override landing.css #container #main-content specificity */
  #container #main-content {
    padding-top: 70px;
    width: auto;
    float: none;
    height: auto;
  }

  #main-content {
    margin-left: 20px;
    margin-right: 20px;
  }

  /* --- A7: Landing page --- */
  body#landing #container,
  body#landing #container2,
  #landing #container2 {
    width: 100%;
  }

  #landing #intro {
    padding-top: 25%;
  }

  #landing #container2 #intro #gray-band {
    padding-left: 30px;
    padding-right: 20px;
    min-height: auto;
  }

  #intro #left {
    width: 100%;
    float: none;
    min-height: auto;
  }

  #intro #right {
    float: none;
    width: auto;
    min-height: auto;
    margin-top: 15px;
    padding-bottom: 15px;
  }

  #intro #right a {
    display: inline-block;
    float: none;
    margin-right: 15px;
    width: auto;
  }
}


/* ==========================================================================
   Mobile (<=768px)
   ========================================================================== */

@media screen and (max-width: 768px) {

  /* --- A4: Tighter margins, readable text --- */
  #main-content {
    margin-left: 15px;
    margin-right: 15px;
  }

  #main-content p {
    font-size: 0.875em;
    line-height: 1.6em;
    text-align: left;
  }

  #main-content li {
    font-size: 0.875em;
    line-height: 1.5em;
  }

  #main-content h1 {
    font-size: 1.1em;
    margin-bottom: 0.75em;
  }

  p.breacrumbs {
    padding-top: 10px;
    font-size: 0.75em;
  }

  p.lang {
    padding-top: 5px;
    font-size: 0.75em;
  }

  /* --- A5: Gallery DL/DT/DD stacked --- */
  dl {
    display: flex;
    flex-direction: column-reverse;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
    clear: none;
  }

  dt {
    float: none;
    width: 100%;
    padding-right: 0;
    font-size: 0.8em;
    line-height: 1.5em;
  }

  dd {
    float: none;
    width: 100%;
    margin-bottom: 10px;
  }

  dd img {
    width: 100%;
  }

  #container #frame #main-content dt p {
    padding-right: 0;
  }

  /* --- A6: Slideshow responsive --- */
  #slides {
    max-width: 100%;
    overflow: hidden;
  }

  .slides_container {
    width: 100% !important;
    max-width: 640px;
  }

  /* Don't override height — the Slides plugin uses absolute positioning
     and needs to manage heights itself. Only override width. */
  .slides_container div {
    width: 100% !important;
  }

  .slides_control {
    max-width: 100%;
    overflow: hidden;
  }

  .slides_container div img {
    width: 100%;
    height: auto;
    display: block;
  }

  /* Slideshow prev/next */
  a.prev, a.next {
    display: inline-block;
    min-width: 44px;
    min-height: 44px;
    line-height: 44px;
    text-align: center;
    font-size: 1.2em;
    padding: 5px 10px;
  }

  #slide_count {
    font-size: 0.8em;
  }

  /* --- A7: Landing page mobile --- */
  #landing #intro {
    padding-top: 15%;
  }

  #landing #container2 #intro #gray-band {
    padding-left: 15px;
    padding-right: 15px;
    height: auto;
  }

  #landing #container2 #intro #gray-band #left li {
    font-size: 0.7em;
    line-height: 1.4em;
  }

  #intro h1 {
    font-size: 1em;
  }

  #intro h2 {
    font-size: 0.65em;
    margin-top: 12px;
  }

  /* --- A8: Touch targets --- */
  #nav li {
    margin-bottom: 0.75em;
  }

  #nav li a,
  #main-nav #nav li a {
    display: block;
    padding: 8px 0;
    font-size: 1em;
  }

  p.breacrumbs a,
  p.lang a {
    display: inline-block;
    padding: 5px 8px;
  }

  dt a {
    display: inline-block;
    padding: 4px 0;
  }

  /* --- A9: Landing enter/entrer links prominent --- */
  #intro #right {
    margin-top: 20px;
  }

  #intro #right ul li a {
    font-size: 1.1em;
    padding: 10px 20px;
    display: inline-block;
    margin-right: 10px;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 4px;
  }

  /* --- A10: Publication list spacing --- */
  #main-content li {
    margin-bottom: 0.5em;
  }
}


/* ==========================================================================
   Tablet gallery: keep side by side but fluid (769-1024px)
   ========================================================================== */

@media screen and (min-width: 769px) and (max-width: 1024px) {
  dl {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    clear: none;
  }

  dt {
    float: none;
    flex: 1;
    width: auto;
    padding-right: 15px;
  }

  dd {
    float: none;
    flex: 0 0 250px;
    width: 250px;
  }
}


/* ==========================================================================
   Small mobile (<=480px)
   ========================================================================== */

@media screen and (max-width: 480px) {
  #landing #intro {
    padding-top: 10%;
  }

  #landing #container2 #intro #gray-band {
    padding-left: 10px;
    padding-right: 10px;
  }

  #container #main-content {
    padding-top: 50px;
  }
}
