/* =========================================================
   RESPONSIVE
   Mobile and tablet refinements
   ========================================================= */

@media (min-width: 901px) {
  .menu-toggle {
    display: none !important;
  }
}

@media (max-width: 1024px) {

  :root {
    --header-height: 112px;
  }

  header {
    height: var(--header-height);
    min-height: var(--header-height);
  }

  nav {
    padding: 0.85rem 1rem;
  }

  .site-title-logo {
    height: calc(var(--header-height) - 28px);
  }

  body {
    padding-top: calc(var(--header-height) + env(safe-area-inset-top));
  }

  main {
    padding-inline: clamp(0.9rem, 2.8vw, 1.4rem);
  }

  section {
    margin-bottom: clamp(1.5rem, 5vw, 3rem);
  }

  .version-box,
  .updates-box,
  .faq-section {
    padding: 1.5rem 1.15rem;
    margin-bottom: 2rem;
  }

  .honorary-members {
    margin: 2.25rem auto;
    padding: 1.25rem 1rem;
  }

  .member-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ebook-list {
    padding: 0.25rem;
  }

  .main-story-list {
    --story-gap: 1.1rem;
    max-width: 100%;
  }

  .main-story-list > li {
    flex-basis: calc((100% - (2 * var(--story-gap))) / 3);
    max-width: calc((100% - (2 * var(--story-gap))) / 3);
  }

  .other-story-list {
    max-width: 420px;
    padding: 0.25rem;
  }

  #ebooks li {
    padding: 1rem 0.9rem;
  }

  #ebooks li h4 {
    font-size: 1.05rem;
  }

  #ebooks li p {
    line-height: 1.45;
  }

  .fancy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #characters .grid {
    --character-grid-gap: 0.8rem;
  }

  #characters .grid .card {
    flex-basis: calc((100% - (2 * var(--character-grid-gap))) / 3);
    max-width: calc((100% - (2 * var(--character-grid-gap))) / 3);
  }

  #characters .card h3 {
    font-size: 0.92rem;
    padding: 0.6rem 0.45rem;
  }

  body[data-page="speciesroles"] .dropdown-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  body[data-page="speciesroles"] .dropdown-card {
    width: 100%;
  }

  body[data-page="speciesroles"] .dropdown-header {
    min-height: 130px;
    padding: 1rem;
    background-position: center;
  }

  body[data-page="speciesroles"] .dropdown-header h3 {
    font-size: 1.35rem;
  }

  body[data-page="speciesroles"] .dropdown-content {
    padding: 1rem;
  }

  body[data-page="speciesroles"] .character-slot-row {
    gap: 0.45rem;
  }

  body[data-page="speciesroles"] .char-tooltip img {
    width: 36px;
    height: 36px;
  }

  .modal {
    width: 100vw;
    height: 100dvh;
    padding: 0.75rem;
    overflow-x: hidden;
  }

  .modal-content {
    width: 100%;
    max-width: 680px;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 12px;
    padding: 1rem 0.95rem 1.1rem;
  }

  .modal-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 42px;
    height: 42px;
    font-size: 2rem;
  }

  .slideshow-controls button {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 900px) {

  #characters .grid {
    --character-grid-gap: 0.6rem;
  }

  #characters .grid .card {
    flex-basis: calc((100% - (2 * var(--character-grid-gap))) / 3);
    max-width: calc((100% - (2 * var(--character-grid-gap))) / 3);
  }

  #characters .card h3 {
    font-size: 0.8rem;
    line-height: 1.2;
    min-height: 2.3em;
    padding: 0.45rem 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }

  nav {
    position: relative;
    align-items: center;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0.45rem 0.7rem;
    font-size: 1.15rem;
    border-radius: 8px;
  }

  .menu-toggle::before {
    content: "";
  }

  .menu-toggle.open {
    background: var(--accent);
    color: #000;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0.75rem;
    right: 0.75rem;

    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.5rem;

    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);

    background: rgba(0, 0, 0, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0 0.6rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);

    transition:
      max-height 0.3s ease,
      opacity 0.25s ease,
      transform 0.25s ease,
      padding 0.3s ease;

    z-index: 1200;
  }

  .nav-links.open {
    max-height: 70vh;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    padding: 0.75rem 0.6rem;
  }

  .nav-links a,
  .nav-links button {
    width: 100%;
    text-align: center;
    padding: 0.72rem 0.85rem;
  }

  .nav-links a::after,
  .nav-links button::after {
    display: none;
  }
}

@media (max-width: 640px) {

  :root {
    --header-height: 100px;
  }

  nav {
    padding: 0.65rem 0.75rem;
  }

  .site-title-logo {
    height: 62px;
  }

  main {
    padding-inline: 0.75rem;
  }

  .main-story-list {
    --story-gap: 0.85rem;
    padding: 0;
  }

  .main-story-list > li {
    flex-basis: calc((100% - var(--story-gap)) / 2);
    max-width: calc((100% - var(--story-gap)) / 2);
  }

  .other-story-list {
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
    padding: 0;
  }

  .homepage-hero {
    max-height: 46svh;
    object-fit: contain;
    border-radius: 10px;
  }

  #info h3 {
    line-height: 1.55;
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .member-grid {
    grid-template-columns: 1fr;
  }

  .version-box,
  .updates-box,
  .faq-section {
    padding: 1.1rem 0.95rem;
    border-radius: 12px;
  }

  .honorary-members {
    padding: 1rem 0.85rem;
  }

  .minimal-footer {
    margin-top: 2rem;
    padding: 0.9rem 1rem;
  }

  .slideshow {
    height: 56vw;
    max-height: none;
  }

  .slide {
    object-fit: contain;
    object-position: center;
  }

  .slide-btn {
    font-size: 1.65rem;
    padding: 0.25rem 0.55rem;
  }

  .bio-card {
    max-width: 92vw;
    padding: 14px;
  }

  #house-lights-btn {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 430px) {
  #characters .grid {
    --character-grid-gap: 0.5rem;
  }

  #characters .grid .card {
    flex-basis: calc((100% - (2 * var(--character-grid-gap))) / 3);
    max-width: calc((100% - (2 * var(--character-grid-gap))) / 3);
  }

  #characters .card h3 {
    font-size: 0.72rem;
    min-height: 2.5em;
    padding: 0.4rem 0.15rem;
    overflow-wrap: anywhere;
  }

  .nav-links a,
  .nav-links button {
    font-size: 0.96rem;
  }

  #ebooks li {
    padding: 0.9rem 0.75rem;
  }

  #ebooks li h4 {
    font-size: 0.95rem;
  }
}

@media (max-width: 360px) {
  .main-story-list {
    --story-gap: 0.65rem;
  }

  .main-story-list > li {
    flex-basis: calc((100% - var(--story-gap)) / 2);
    max-width: calc((100% - var(--story-gap)) / 2);
  }

  #ebooks li {
    padding: 0.75rem 0.55rem;
  }

  #ebooks li h4 {
    font-size: 0.88rem;
    line-height: 1.25;
  }

  #ebooks li p {
    font-size: 0.86rem;
    line-height: 1.4;
  }

  #ebooks li .fancy-btn {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    line-height: 1.2;
    white-space: normal;
  }
}
button,
.nav-links button,
.nav-links a,
.slide-btn,
.sound-button,
.reveal-btn {
  min-height: 44px;
  min-width: 44px;
}















