/**
 * Responsive Styles - Kahuna the Elder Theme
 * Mobile-first responsive design with breakpoints
 */

/* ============================================================================
   Mobile First (Default) - 320px to 640px
   ============================================================================ */

/* Header - Mobile */
header {
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
}

.site-header-branding {
  width: 100%;
  text-align: center;
}

.site-title {
  font-size: 1.25rem;
}

.site-description {
  font-size: 0.75rem;
}

/* Navigation - Mobile */
nav.wp-block-navigation {
  width: 100%;
  order: 3;
}

.wp-block-navigation__container {
  flex-direction: column;
  width: 100%;
  gap: var(--space-sm);
}

.wp-block-navigation-item {
  width: 100%;
}

.wp-block-navigation-item__content a {
  display: block;
  padding: var(--space-md);
}

/* Submenu - Mobile (click instead of hover) */
.wp-block-navigation-item__submenu-container {
  position: static;
  display: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  min-width: 100%;
}

.wp-block-navigation-item__content a {
  width: 100%;
}

.wp-block-navigation-item__submenu-container .wp-block-navigation-item__content a {
  padding-left: var(--space-xl);
  background: rgba(0, 0, 0, 0.02);
}

/* Hero Section - Mobile */
.hero-section {
  height: 225px;
  background: rgba(0, 0, 0, 0.9) !important;
  padding: 0 !important;
}

.hero-content h1,
.hero-title,
.wp-block-kahunatheelder-hero .hero-title {
  font-size: 2rem;
  padding: var(--space-lg) var(--space-md);
}

.hero-content p {
  font-size: 1rem;
}

.hero-image {
  flex: 0 0 40%;
}

/* Content Wrapper - Mobile */
.content-wrapper {
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-md);
}

.main-content {
  width: 100%;
}

.sidebar-content {
  width: 100%;
}

/* Post Title - Mobile */
.post-title,
.page-title {
  font-size: 1.5rem;
}

/* Featured Image - Mobile */
.post-featured-image,
.page-featured-image {
  margin-bottom: var(--space-md);
}

/* Content Text - Mobile */
.post-content,
.page-content {
  font-size: 0.95rem;
}

.post-content h2,
.page-content h2 {
  font-size: 1.375rem;
  margin: var(--space-lg) 0 var(--space-md) 0;
}

.post-content h3,
.page-content h3 {
  font-size: 1.125rem;
  margin: var(--space-md) 0 var(--space-sm) 0;
}

/* Post Navigation - Mobile */
.post-navigation {
  grid-template-columns: 1fr;
  gap: var(--space-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
}

/* Footer - Mobile */
footer {
  padding: var(--space-lg) var(--space-md);
}

.footer-content {
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.footer-copyright {
  font-size: 0.75rem;
}

/* Sidebar Widgets - Mobile */
.sidebar-widget {
  padding: var(--space-md);
}

.sidebar-widget h3 {
  font-size: 1.1rem;
}

/* Post List - Mobile */
.post-item {
  padding: var(--space-md);
}

.post-item-title {
  font-size: 1.25rem;
}

.post-item-meta {
  font-size: 0.8rem;
}

/* Search Form - Mobile */
.search-form {
  flex-direction: column;
  gap: var(--space-sm);
}

.search-form input[type="search"] {
  padding: var(--space-sm);
}

.search-form button {
  padding: var(--space-md);
}

/* Tables - Mobile */
table {
  font-size: 0.9rem;
}

table th,
table td {
  padding: var(--space-sm);
}

/* ============================================================================
   Tablet - 640px to 1024px
   ============================================================================ */

@media (min-width: 640px) {

  /* Header - Tablet */
  header {
    flex-direction: row;
    padding: var(--space-lg) var(--space-lg);
  }

  .site-header-branding {
    flex: 1;
    text-align: left;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .site-description {
    font-size: 0.8rem;
  }

  /* Navigation - Tablet */
  nav.wp-block-navigation {
    width: auto;
    order: initial;
  }

  .wp-block-navigation__container {
    flex-direction: row;
    width: auto;
    gap: var(--space-md);
  }

  .wp-block-navigation-item {
    width: auto;
  }

  .wp-block-navigation-item__content a {
    padding: var(--space-sm) var(--space-md);
  }

  /* Hero Section - Tablet */
  .hero-section {
    height: 225px;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
  }

  /* Hero section text sizes removed - using inline style from PHP */

  .hero-content p {
    font-size: 1.05rem;
  }

  .hero-image {
    flex: 0 0 45%;
  }

  /* Content Wrapper - Tablet */
  .content-wrapper {
    grid-template-columns: 2fr 1fr;
    padding: var(--space-xl) var(--space-lg);
  }

  /* Post Title - Tablet */
  .post-title,
  .page-title {
    font-size: 2rem;
  }

  /* Footer - Tablet */
  footer {
    padding: var(--space-xl) var(--space-lg);
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }

  /* Search Form - Tablet */
  .search-form {
    flex-direction: row;
  }

  /* Sidebar Widgets - Tablet */
  .sidebar-widget {
    padding: var(--space-lg);
  }

  /* Post List - Tablet */
  .post-item {
    padding: var(--space-lg);
  }
}

/* ============================================================================
   Desktop - 1024px and above
   ============================================================================ */

@media (min-width: 1024px) {

  /* Header - Desktop */
  header {
    padding: var(--space-lg) var(--space-xl);
  }

  .site-title {
    font-size: clamp(1.5rem, 1rem + 2vw, 2rem);
  }

  /* Navigation - Desktop (restore hover behavior) */
  .wp-block-navigation__container {
    gap: var(--space-lg);
  }

  .wp-block-navigation-item:hover .wp-block-navigation-item__submenu-container {
    display: block;
  }

  /* Hero Section - Desktop */
  .hero-section {
    height: 225px;
    padding: 0 !important;
  }

  .hero-image {
    flex: 0 0 50%;
  }

  /* Content Wrapper - Desktop */
  .content-wrapper {
    padding: var(--space-2xl) var(--space-xl);
  }

  /* Post Title - Desktop */
  .post-title,
  .page-title {
    font-size: clamp(1.75rem, 1.25rem + 2vw, 2.5rem);
  }

  /* Footer - Desktop */
  footer {
    padding: var(--space-2xl) var(--space-xl);
  }

  .footer-content {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Archive Background - Desktop */
  .archive-background {
    padding: var(--space-2xl) var(--space-xl);
    margin: -var(--space-2xl) -var(--space-xl) 0 -var(--space-xl);
  }
}

/* ============================================================================
   Large Desktop - 1400px and above
   ============================================================================ */

@media (min-width: 1400px) {

  .content-wrapper,
  header,
  footer,
  .hero-section {
    max-width: 1400px;
  }
}

/* ============================================================================
   Extra Large - 1920px and above
   ============================================================================ */

@media (min-width: 1920px) {

  /* Increase spacing on very large screens */
  :root {
    --space-xl: 3rem;
    --space-2xl: 4rem;
  }

  header {
    padding: var(--space-xl);
  }

  footer {
    padding: var(--space-2xl) var(--space-xl);
  }

  .content-wrapper {
    padding: var(--space-2xl) var(--space-xl);
  }
}

/* ============================================================================
   High Contrast / Dark Mode Support
   ============================================================================ */

@media (prefers-contrast: more) {

  /* Increase border thickness */
  .sidebar-widget,
  .post-item {
    border-left-width: 6px;
  }

  /* Increase text contrast */
  .post-content,
  .page-content {
    color: #000;
  }

  /* Increase button contrast */
  .wp-block-button__link,
  button,
  input[type="button"],
  input[type="submit"] {
    border: 2px solid #000;
  }
}

/* ============================================================================
   Reduced Motion Support
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {

  /* Remove all animations and transitions */
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Keep keyframe animations removed */
  @keyframes slideDown {
    from {
      opacity: 1;
      transform: none;
    }

    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {

  /* Hide navigation and non-essential elements */
  header,
  footer,
  nav,
  .sidebar-content,
  .post-navigation,
  .search-form,
  button,
  .wp-block-button__link {
    display: none;
  }

  /* Adjust layout for print */
  body {
    background: white;
  }

  .content-wrapper {
    grid-template-columns: 1fr;
    padding: 0;
  }

  /* Print friendly colors */
  .post-title,
  .page-title {
    color: #000;
  }

  /* Make links visible in print */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Page breaks */
  .post-item {
    page-break-inside: avoid;
  }
}

/* ============================================================================
   Touch Device Support
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {

  /* Increase tap targets for touch */
  .wp-block-navigation-item__content a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Larger buttons for touch */
  button,
  .wp-block-button__link {
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
  }

  /* Hover effects don't apply to touch */
  .post-item:hover {
    transform: none;
  }

  /* Submenu requires explicit click handling */
  .wp-block-navigation-item__submenu-container {
    display: none !important;
  }
}

/* ============================================================================
   Landscape Orientation (Mobile)
   ============================================================================ */

@media (max-height: 600px) and (orientation: landscape) {

  /* Reduce vertical padding for landscape mobile */
  .hero-section {
    min-height: 300px;
    padding: var(--space-lg) var(--space-md);
  }

  .hero-image {
    min-height: 300px;
  }

  .content-wrapper {
    padding: var(--space-lg) var(--space-md);
  }

  header {
    padding: var(--space-md);
  }
}

/* ============================================================================
   Utility Classes for Responsive Display
   ============================================================================ */

/* Hide on mobile, show on tablet+ */
.hide-mobile,
.show-desktop {
  display: none;
}

@media (min-width: 1024px) {

  .hide-mobile,
  .show-desktop {
    display: block;
  }

  .hide-desktop,
  .show-mobile {
    display: none !important;
  }
}

/* Container queries fallback for older browsers */
@supports not (container-type: inline-size) {

  /* Gracefully degrade if container queries not supported */
  .content-wrapper {
    grid-template-columns: 2fr 1fr;
  }

  @media (max-width: 1024px) {
    .content-wrapper {
      grid-template-columns: 1fr;
    }
  }
}

/* Twitch Embed Block */
.kahunatheelder-twitch-embed {
  width: 100%;
  max-width: 100%;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(145, 70, 255, 0.05);
  border-radius: 0.75rem;
}

.kahunatheelder-twitch-embed iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

@media (max-width: 768px) {
  .kahunatheelder-twitch-embed {
    padding: 1rem;
    margin: 1.5rem 0;
  }

  .kahunatheelder-twitch-embed iframe {
    aspect-ratio: 16 / 9;
    min-height: 300px;
  }
}