/*
 * Mobile navigation and sidebar additions.
 * This is deliberately separate from style.css so existing desktop styling,
 * awards styling and later design changes are not overwritten.
 */

.site-header-image,
.menu-toggle,
.sidebar-toggle {
  display: none;
}

#logo_text h1 a,
.sidebar h2 a {
  color: inherit;
  text-decoration: none;
}

@media screen and (max-width: 760px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

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

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

  #main {
    width: 100%;
  }

  /* Replace the fixed-width CSS background with the full responsive banner. */
  #header {
    height: auto !important;
    min-height: 0;
    background: #33ccff !important;
    border: 0 !important;
  }

  #header::after {
    display: none !important;
  }

  #logo {
    position: relative;
    width: 100% !important;
    height: auto !important;
    min-height: 0;
    background: none !important;
  }

  .site-header-image {
    display: block;
    width: 100%;
    height: auto;
  }

  #logo #logo_text {
    position: static;
    width: 100%;
    padding: 8px 15px 10px;
    text-align: center;
    background: #33ccff;
  }

  #logo #logo_text h1 {
    margin: 0;
    padding: 0;
    font-size: 175%;
    line-height: 1.25;
  }

  #logo #logo_text h1 a {
    display: inline-block;
  }

  /* Hamburger-style expandable navigation. */
  #menubar {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
  }

  .menu-toggle {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-top: 3px solid #33ccff;
    background: #003399;
    color: #fff;
    font: bold 14px Arial, Helvetica, sans-serif;
    line-height: 1.25;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
  }

  .menu-toggle::after {
    content: "☰";
    float: right;
    font-size: 20px;
    line-height: 16px;
  }

  .menu-toggle.is-open::after {
    content: "×";
    font-size: 24px;
  }

  ul#menu {
    display: none !important;
    float: none !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #003399 !important;
  }

  ul#menu.is-open {
    display: block !important;
  }

  ul#menu li {
    display: block !important;
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  ul#menu li a,
  ul#menu li strong {
    display: block !important;
    float: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    margin: 0 !important;
    padding: 12px 18px !important;
    border: 0 !important;
    border-top: 1px solid #1683cf !important;
    background: #003399 !important;
    color: #fff !important;
    font: normal 13px/20px "lucida sans unicode", Arial, sans-serif !important;
    text-align: left !important;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: none !important;
  }

  ul#menu li a:hover,
  ul#menu li a:focus {
    background: #0647aa !important;
  }

  ul#menu li strong {
    padding-left: 15px !important;
    border-left: 4px solid #33ccff !important;
    background: #002b80 !important;
    color: #33ccff !important;
    font-weight: bold !important;
  }

  /* Main content first; sidebar follows underneath. */
  #site_content {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 20px 16px 24px;
    overflow: visible !important;
  }

  #content {
    order: 1;
    width: 100% !important;
    min-width: 0;
    padding: 0 !important;
  }

  .sidebar {
    order: 2;
    float: none !important;
    width: 100% !important;
    margin: 22px 0 0;
    padding: 0 !important;
  }

  .sidebar-toggle {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid #b9d6ee;
    border-left: 4px solid #33ccff;
    background: #eef7ff;
    color: #003399;
    font: bold 14px/20px Arial, Helvetica, sans-serif;
    text-align: left;
    cursor: pointer;
  }

  .sidebar-toggle::after {
    content: "+";
    float: right;
    font-size: 21px;
    line-height: 18px;
  }

  .sidebar-toggle.is-open::after {
    content: "−";
  }

  .sidebar-inner {
    display: none;
    padding: 16px 12px 4px;
    border: 1px solid #d7e3ee;
    border-top: 0;
    background: #f8fbfe;
  }

  .sidebar-inner.is-open {
    display: block;
  }

  .sidebar ul {
    width: 100% !important;
  }

  .sidebar .right {
    float: none;
    display: block;
    margin: 0 auto;
  }

  /* Existing fee tables remain readable on narrow phones. */
  #content table {
    display: table;
    width: 100% !important;
    table-layout: fixed;
  }

  #content table th,
  #content table td {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  #content table th:last-child,
  #content table td:last-child {
    width: 28%;
  }

  /* Awards stack neatly while retaining their card styling. */
  .award-card {
    display: block !important;
    padding: 14px !important;
  }

  .award-image,
  .award-year-panel,
  .award-placeholder {
    width: 100% !important;
    max-width: 240px;
    margin: 0 auto 14px !important;
  }

  #footer {
    width: 100% !important;
    height: auto !important;
    padding: 18px 16px !important;
    line-height: 1.5;
  }
}

@media screen and (max-width: 430px) {
  #logo #logo_text h1 {
    font-size: 150%;
  }

  #site_content {
    padding-right: 12px;
    padding-left: 12px;
  }

  #content h1 {
    font-size: 165%;
  }

  #content table {
    font-size: 92%;
  }

  #content table th,
  #content table td {
    padding: 7px 5px;
  }
}
