/* ==========================================================================
   responsive.css — Media queries and mobile navigation for hamz.me theme
   Breakpoints: Desktop ≥960px | Tablet 550-959px | Mobile <550px
   ========================================================================== */

/* --------------------------------------------------------------------------
   Mobile Top Bar — Hidden on desktop, visible on tablet/mobile
   -------------------------------------------------------------------------- */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background-color: var(--sidebar-bg);
  z-index: 101;
  padding: 0 var(--space-md);
  align-items: center;
  justify-content: space-between;
}

.mobile-topbar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--sidebar-text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-topbar-toggle:hover {
  color: var(--sidebar-text);
}

.mobile-topbar-toggle svg {
  width: 20px;
  height: 20px;
}

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

.mobile-topbar-logo img {
  height: 30px;
  width: auto;
}

.mobile-topbar-logo span {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: var(--fw-bold);
  color: var(--sidebar-text);
}

/* Hamburger button */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--sidebar-text);
  border-radius: 1px;
  transition: transform var(--transition-base),
              opacity var(--transition-base);
}

/* Hamburger → X animation */
.hamburger-btn.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.is-active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Tablet — 550px to 959px
   -------------------------------------------------------------------------- */
@media (max-width: 959px) {
  /* Show mobile top bar */
  .mobile-topbar {
    display: flex;
  }

  /* Content no longer offset by sidebar */
  .site-content {
    margin-right: 0;
    padding-top: var(--topbar-height);
  }

  /* Sidebar becomes slide-in overlay from right */
  .site-sidebar {
    transform: translateX(100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    padding-top: calc(var(--topbar-height) + var(--space-xl));
  }

  .site-sidebar.is-open {
    transform: translateX(0);
  }

  /* Content area full width */
  .content-area {
    padding: var(--space-xl) var(--space-lg);
  }
}

/* --------------------------------------------------------------------------
   Mobile — Under 550px
   -------------------------------------------------------------------------- */
@media (max-width: 549px) {
  /* Tighter content padding */
  .content-area {
    padding: var(--space-lg) var(--space-md);
  }

  /* Smaller heading sizes */
  h1, .entry-title, .post-title {
    font-size: 1.75rem; /* 28px */
  }

  h2 {
    font-size: 1.5rem; /* 24px */
  }

  h3 {
    font-size: 1.25rem; /* 20px */
  }

  /* Post entries — tighter spacing */
  .post-entry {
    padding-bottom: var(--space-xl);
    margin-bottom: var(--space-xl);
  }

  .post-entry-title {
    font-size: 1.25rem;
  }

  /* Pagination stack */
  .pagination {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  /* Post navigation stack */
  .post-navigation {
    flex-direction: column;
    gap: var(--space-lg);
  }

  /* Columns go single */
  .wp-block-columns {
    flex-direction: column;
  }

  /* Code blocks — smaller padding */
  pre[class*="language-"],
  .wp-block-code {
    padding: var(--space-md);
    border-radius: 6px;
    font-size: 0.8125rem;
  }

  /* Blockquote */
  blockquote,
  .wp-block-quote {
    padding: var(--space-sm) var(--space-md);
  }

  /* Table horizontal scroll */
  .wp-block-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --------------------------------------------------------------------------
   Focus Styles (accessibility)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .site-sidebar,
  .mobile-topbar,
  .sidebar-overlay,
  .theme-toggle-btn,
  .hamburger-btn {
    display: none !important;
  }

  .site-content {
    margin-right: 0 !important;
    padding-top: 0 !important;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 12pt;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}
