/* -------------------------------------------------
   mobile.css – mobile-first & responsive overrides
   ------------------------------------------------- */

/* MOBILE-FIRST: Base mobile styling */

/* Hide hamburger by default (desktop) */
#menu-toggle {
  display: none;
  order: -1;
}

/* Enhance touch targets on mobile */
@media (max-width: 768px) {
  /* Site header layout - ensure proper flex organization */
  .site-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.5rem;
    position: relative;
    padding: 0.75rem 0.5rem;
  }

  /* Hamburger menu button - positioned on the left */
  #menu-toggle {
    display: block;
    appearance: none;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    margin: 0;
    order: -1;
    flex-shrink: 0;
  }

  #menu-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 0.3rem;
  }

  /* Title - flex to push theme toggle to the right */
  .site-title {
    flex: 1;
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin: 0;
    text-align: center;
  }

  /* Navigation tabs - stack vertically on mobile */
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 999;
  }

  .main-nav.open {
    max-height: 500px;
    overflow-y: auto;
  }

  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    margin: 0;
  }

  .main-nav li {
    line-height: 1;
  }

  .main-nav a {
    display: flex;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 0;
    white-space: normal;
    min-height: 48px;
    align-items: center;
    color: var(--txt-primary);
    text-decoration: none;
  }

  .main-nav a:hover {
    background: var(--surface-tint);
  }

  .main-nav a.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
  }

  /* Remove underline animation on mobile for active state */
  .main-nav a::after {
    display: none;
  }

  /* Better spacing for touch on mobile */
  a, button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
  }

  /* Adjust navigation gap on mobile */
  .main-nav ul {
    gap: 0;
  }

  /* Better readability on mobile */
  body {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  input, textarea, select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Reduce padding/margin on mobile */
  .site-header,
  .site-footer {
    padding: 0.75rem 1rem;
    position: relative;
  }

  /* Adjust hero section padding on mobile */
  .hero {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
  }

  /* Full-width on mobile */
  .quick-links {
    flex-direction: column;
    gap: 1rem;
  }

  .quick-links a {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

/* TABLET: Medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Hide hamburger on tablet */
  #menu-toggle {
    display: none !important;
  }

  /* Show navigation on tablet */
  .main-nav {
    position: static !important;
    background: none !important;
    border: none !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .site-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
  }

  .main-nav ul {
    gap: 1rem;
    flex-direction: row;
  }

  .main-nav a {
    padding: 0.4rem 0.8rem;
    font-size: 1rem;
    display: inline-block;
  }
}

/* DESKTOP: Large screens */
@media (min-width: 1025px) {
  /* Reset mobile styles */
  #menu-toggle {
    display: none !important;
  }

  .site-header {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .site-title {
    font-size: clamp(3rem, 10vw, 6rem);
  }

  /* Show navigation on desktop */
  .main-nav {
    position: static !important;
    background: none !important;
    border: none !important;
    max-height: none !important;
    overflow: visible !important;
    flex-basis: auto;
  }

  .main-nav ul {
    gap: 1.5rem;
  }

  /* Show underline animation only on desktop */
  .main-nav a::after {
    display: block;
  }
}

/* LANDSCAPE MOBILE: Adjust for landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .site-header {
    padding: 0.5rem 1rem;
  }

  .site-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .hero {
    padding: 1rem;
  }

  .tagline {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
  }
}

/* Accessibility: Reduce motion for those who prefer it */
@media (prefers-reduced-motion: reduce) {
  .main-nav,
  .main-nav a,
  .main-nav a::after {
    transition: none;
  }
}

/* Ensure proper button styling */
button {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Ensure theme toggle doesn't break on mobile */
#theme-toggle {
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  #theme-toggle {
    margin-left: 0.5rem;
  }
}
