/* ============================================================
   1. GLOBAL MOBILE RESET
   ============================================================ */

@media (max-width: 768px) {

  /* Remove desktop spacing that causes overflow */
  .site-grid,
  .container-component {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Ensure full-width stacking */
  .site-grid {
    display: block !important;
  }

  /* Sidebar moves below content */
  .container-sidebar-right {
    order: 99;
    margin-top: 1.5rem;
  }

  /* Global background animation adjustments */
  body {
    background-size: 300% 300%;
    animation-duration: 22s;
  }
}


/* ============================================================
   2. HEADER + DIVISION GROUP (GLOBAL)
   ============================================================ */

@media (max-width: 768px) {

  .header-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    min-height: 80px;
    gap: 0.5rem;
    text-align: center;
  }

  .main-logo {
    display: flex;
    align-items: center;
  }

  .main-logo img {
    max-height: 50px !important;
  }

  .welcome-text {
    text-align: left !important;
    margin: 0;
    padding: 0;
    max-width: 80%;
    line-height: 1.2;
  }

  .divisions {
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
  }

  .division-logo img {
    max-height: 50px;
  }

  .division-btn.header-division {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  /* Disable desktop animations */
  .division-block,
  .main-logo img,
  .welcome-text {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}


/* ============================================================
   3. UNIFIED DIVISION TOPBAR (GLOBAL)
   ============================================================ */

@media (max-width: 768px) {

  .division-topbar {
    flex-direction: column;
    text-align: center;
    padding: 0.5rem;
  }

  .division-topbar .topbar-logo img {
    max-height: 60px;
  }

  .division-topbar .topbar-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
  }

  .topbar-link-item {
    flex: 1 1 45%;
    min-width: 120px;
  }

  .topbar-link-item img {
    max-width: 50px;
  }

  .topbar-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }
}

/* ============================================================
   4. OVERVIEW TOPBAR (2×2 GRID + LEFT‑ALIGN FIX)
   ============================================================ */

@media (max-width: 900px) {

  /* Right side becomes 2×2 grid */
  .overview-topbar .topbar-right {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
  }

  .overview-topbar .topbar-link-item {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .overview-topbar .topbar-btn {
    width: 100%;
  }

  /* Hide icons for clean grid */
  .overview-topbar .topbar-link-item img {
    display: none !important;
  }
}

/* --- LEFT‑ALIGN LOGO + SPOKEN TEXT FIX --- */

@media (max-width: 768px) {

  /* Keep topbar stacked vertically */
  .overview-topbar.division-topbar {
    flex-direction: column !important;
    text-align: center;
  }

  /* Left block aligned left */
  .overview-topbar .topbar-left {
    width: 100%;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: left !important;
    margin-bottom: 0.5rem;
  }

  /* Logo + spoken text wrapper */
  .overview-topbar .topbar-logo {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.5rem;
  }

  .overview-topbar .spoken-text {
    text-align: left !important;
    white-space: nowrap;
  }
}

/* ============================================================
   5. MAIN-TOP GRID (BLOG + PROJECTS)
   ============================================================ */

@media (max-width: 768px) {

  #main-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  #main-top .blog-box,
  #main-top .projects-box {
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 100%;
  }

  .blog .img-intro-none img,
  .blog .img-intro-left img,
  .blog .img-intro-right img {
    width: 100%;
    height: auto;
  }
}

/* ============================================================
   6. GATEWAY TILES
   ============================================================ */

@media (max-width: 768px) {

  .tile-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    padding: 0.5rem 0;
  }

  .tile {
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    transform: none !important;
  }

  .tile:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  }

  .tile h3 {
    font-size: 1rem;
  }

  /* Disable intro animations */
  .intro-container,
  .intro-image,
  .intro-text {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   7. MEETMARCO MODULE
   ============================================================ */

@media (max-width: 768px) {

  .intro-overlay-box {
    width: 94%;
    padding: 0.5rem 0.7rem;
  }

  .intro-main-text {
    font-size: 0.72rem;
  }

  .intro-footnote {
    font-size: 0.55rem;
  }
}

/* ============================================================
   8. SONG LAYOUT (MUSIC ARTICLES)
   ============================================================ */

@media (max-width: 768px) {

  .song-layout {
    flex-direction: column;
    padding: 0.75rem;
    gap: 1rem;
    box-shadow: none;
    max-width: 95%;
  }

  .song-layout .song-block {
    max-width: 100%;
  }

  .cover-image {
    max-width: 100%;
    height: auto;
  }

  .song-layout .lyrics-block {
    column-count: 1;
    font-size: 1rem;
    line-height: 1.5;
    max-height: none;
    overflow: visible;
  }
}

/* ============================================================
   9. BIO
   ============================================================ */

@media (max-width: 768px) {

  .bio-container .float-left,
  .bio-container .float-right {
    float: none;
    display: block;
    margin: 1em auto;
  }

  .bio-container {
    padding: 0 1rem;
  }
}

/* ============================================================
   10. FOOTER
   ============================================================ */

@media (max-width: 768px) {

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
    padding: 0.5rem 0.75rem;
  }

  .footer-block {
    padding: 0 0.25rem;
  }

  .footer-block::after {
    display: none;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-btn {
    flex: 1 1 45%;
  }

  /* Kill Cassiopeia's mobile footer container */
  footer.footer,
  footer.footer .grid-child,
  footer.footer .container-component,
  footer.footer .container {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    display: block !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* ============================================================
   11. LOGIN COLLAPSIBLE
   ============================================================ */

.login-collapsible {
  display: none;
  transition: all 0.3s ease;
}

.login-collapsible.open {
  display: block;
}

/* ============================================================
   MOBILE — REMOVE EMPTY BACKGROUND BUTTONS IN LIGHT MODE
   ============================================================ */

@media (max-width: 768px) {
  html[data-theme="light"] .overview-topbar .topbar-link-item a {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important; /* optional: keeps layout tight */
  }
}
