/* ============================================
   THE AI VALLEY PODCAST - RESPONSIVE STYLES
   Mobile-First Breakpoints
   ============================================ */

/* ============================================
   SMALL SCREENS (Mobile)
   ============================================ */

@media (max-width: 639px) {
  :root {
    --container-padding: 1rem;
  }

  /* Prevent horizontal overflow */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .container {
    padding: 0 var(--container-padding);
    overflow-x: hidden;
  }

  /* Navigation */
  .nav-container {
    padding: var(--space-sm) var(--container-padding);
  }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-xl);
    gap: var(--space-lg);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
    z-index: var(--z-nav);
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-menu-btn.active .hamburger {
    background: transparent;
  }

  .mobile-menu-btn.active .hamburger::before {
    transform: rotate(45deg) translate(5px, 6px);
  }

  .mobile-menu-btn.active .hamburger::after {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  .subscribe-dropdown {
    width: 100%;
  }

  .dropdown-menu {
    position: static;
    margin-top: var(--space-sm);
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .subscribe-dropdown.open .dropdown-menu {
    display: block;
  }

  .logo-text {
    font-size: 0.9rem;
    letter-spacing: 0.03em;
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  /* Hero */
  .hero {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    padding: calc(70px + var(--space-md)) var(--container-padding) var(--space-xl);
    min-height: auto;
    gap: var(--space-md);
    overflow: hidden;
    max-width: 100%;
  }

  .hero-content {
    order: 2;
    text-align: center;
    width: 100%;
    padding: 0;
  }

  .hero-title {
    font-size: 1.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    margin-bottom: var(--space-sm);
  }

  .hero-tagline {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: var(--space-md);
  }

  .hero-badge {
    font-size: 0.6rem;
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.8rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .hero-visual {
    display: flex;
    order: 1;
    width: 100%;
    justify-content: center;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-md);
  }

  .hero-image-container {
    max-width: 250px;
    width: 70%;
    margin: 0 auto;
  }

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

  .scroll-indicator {
    display: none;
  }

  /* Section Headers */
  .section-title {
    font-size: 1.5rem;
  }

  .section-tag {
    font-size: 0.65rem;
  }

  /* Featured Section */
  .featured-section {
    padding: var(--space-xl) 0;
  }

  .featured-content {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    text-align: center;
  }

  .featured-image {
    width: 120px;
    height: 120px;
    margin: 0 auto;
  }

  .featured-info {
    text-align: center;
  }

  .featured-badge {
    justify-content: center;
  }

  .featured-title {
    font-size: 1.1rem;
  }

  .featured-description {
    font-size: 0.85rem;
  }

  .featured-meta {
    justify-content: center;
  }

  .featured-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .featured-actions .btn {
    width: 100%;
  }

  .featured-apple-embed iframe {
    max-width: 100% !important;
  }

  /* Episodes */
  .episodes-section {
    padding: var(--space-xl) 0;
  }

  .filter-bar {
    gap: var(--space-xs);
    padding-bottom: var(--space-md);
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    margin: 0 calc(-1 * var(--container-padding));
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: var(--space-sm) var(--space-md);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .episodes-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .episode-card {
    padding: var(--space-md);
  }

  .card-header {
    margin-bottom: var(--space-sm);
  }

  .card-number {
    font-size: 0.7rem;
  }

  .card-play-btn {
    font-size: 0.65rem;
    padding: var(--space-xs) var(--space-sm);
  }

  .card-title {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .card-meta {
    font-size: 0.7rem;
  }

  .card-description {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .card-footer {
    margin-top: var(--space-md);
  }

  .card-link {
    font-size: 0.7rem;
  }

  /* Load More */
  .load-more-container {
    padding: var(--space-lg) 0;
  }

  #load-more-btn {
    width: 100%;
    padding: var(--space-md);
  }

  /* Global Player */
  .global-player {
    padding: var(--space-sm) 0;
  }

  .global-player .player-container {
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--container-padding);
  }

  .player-info {
    flex: 0 0 100%;
    order: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .player-title {
    font-size: 0.75rem;
  }

  .player-controls {
    order: 2;
  }

  .player-progress {
    flex: 1 0 calc(100% - 150px);
    order: 3;
  }

  .player-extras {
    order: 4;
    flex: 0 0 auto;
  }

  .volume-control {
    display: none;
  }

  .player-time {
    min-width: 70px;
    font-size: 0.6rem;
  }

  /* About */
  .about-section {
    padding: var(--space-xl) 0;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .terminal-window {
    margin: 0;
  }

  .terminal-body {
    font-size: 0.8rem;
    padding: var(--space-md);
    line-height: 1.6;
  }

  .host-card {
    padding: var(--space-md);
  }

  /* Footer */
  .main-footer {
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .footer-ascii {
    display: none;
  }

  .footer-top {
    flex-direction: column;
    text-align: center;
    gap: var(--space-lg);
  }

  .footer-middle {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    text-align: center;
  }

  .footer-column h4 {
    font-size: 0.75rem;
  }

  .footer-links {
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }

  .copyright {
    font-size: 0.7rem;
  }

  .footer-status {
    font-size: 0.65rem;
  }

  /* Episode Detail Page */
  .episode-main {
    padding-top: 70px;
  }

  .back-link {
    font-size: 0.65rem;
    margin-bottom: var(--space-lg);
  }

  .episode-header {
    text-align: center;
  }

  .episode-title {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .episode-meta-top,
  .episode-meta-bottom {
    justify-content: center;
    font-size: 0.7rem;
  }

  .episode-artwork {
    max-width: 200px;
    margin: 0 auto var(--space-lg);
  }

  .episode-player {
    padding: var(--space-md);
  }

  .player-display-large {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .display-title {
    font-size: 0.8rem;
  }

  .display-waveform {
    display: none;
  }

  .player-controls-large {
    gap: var(--space-md);
  }

  .play-btn-large {
    width: 60px;
    height: 60px;
  }

  .play-icon-large {
    font-size: 1.5rem;
  }

  .control-btn {
    padding: var(--space-sm);
  }

  .control-label {
    font-size: 0.6rem;
  }

  .player-options {
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
  }

  .volume-control-large {
    display: none;
  }

  .speed-control {
    font-size: 0.7rem;
  }

  .download-btn .option-label {
    display: none;
  }

  .episode-platforms {
    text-align: center;
  }

  .platforms-label {
    display: block;
    margin-bottom: var(--space-sm);
  }

  .platform-buttons {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .platform-btn {
    width: 100%;
    justify-content: center;
    padding: var(--space-md);
  }

  .apple-podcast-embed {
    margin: var(--space-lg) 0;
  }

  .apple-podcast-embed iframe {
    max-width: 100% !important;
  }

  .episode-content {
    margin: var(--space-lg) 0;
  }

  .content-title {
    font-size: 1rem;
  }

  .show-notes {
    font-size: 0.85rem;
  }

  .episode-navigation {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .nav-episode {
    padding: var(--space-md);
  }

  .nav-prev, .nav-next {
    text-align: center;
  }

  .nav-ep-title {
    font-size: 0.75rem;
  }

  /* Contact Page */
  .contact-main {
    padding: var(--space-xl) 0;
  }

  .contact-header {
    margin-bottom: var(--space-xl);
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .contact-intro {
    font-size: 0.9rem;
    text-align: center;
  }

  .contact-reasons {
    padding: var(--space-md);
  }

  .contact-reasons li {
    font-size: 0.85rem;
  }

  .contact-form {
    padding: var(--space-md);
  }

  .form-label {
    font-size: 0.75rem;
  }

  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: var(--space-md);
  }

  .form-submit {
    padding: var(--space-md);
    font-size: 0.85rem;
  }

  .disclaimer-section {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
  }

  .disclaimer-title {
    font-size: 1rem;
  }

  .disclaimer-body {
    padding: var(--space-md);
  }

  .disclaimer-body p {
    font-size: 0.8rem;
    line-height: 1.7;
  }
}

/* ============================================
   MEDIUM SCREENS (Tablet)
   ============================================ */

@media (min-width: 640px) and (max-width: 1023px) {
  /* Prevent horizontal overflow */
  html, body {
    overflow-x: hidden;
  }

  /* Navigation */
  .nav-links {
    gap: var(--space-lg);
  }

  .logo-text {
    font-size: 1.125rem;
  }

  /* Hero - Single column on tablet too */
  .hero {
    display: flex;
    flex-direction: column;
    padding: calc(80px + var(--space-xl)) var(--container-padding) var(--space-2xl);
    gap: var(--space-xl);
  }

  .hero-content {
    order: 2;
    text-align: center;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-visual {
    display: flex;
    order: 1;
    justify-content: center;
    margin-bottom: var(--space-lg);
  }

  .hero-image-container {
    max-width: 350px;
    margin: 0 auto;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  /* Episodes Grid */
  .episodes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Featured */
  .featured-content {
    text-align: center;
  }

  .featured-info {
    text-align: center;
  }

  .featured-badge {
    justify-content: center;
  }

  .featured-meta {
    justify-content: center;
  }

  .featured-image {
    width: 180px;
    height: 180px;
    margin: 0 auto;
  }

  /* About */
  .about-content {
    grid-template-columns: 1fr;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-middle {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-ascii {
    font-size: 0.4rem;
    overflow: hidden;
  }
}

/* ============================================
   LARGE SCREENS (Desktop)
   ============================================ */

@media (min-width: 1024px) {
  /* Navigation */
  .nav-links {
    gap: var(--space-xl);
  }

  /* Hero */
  .hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3xl);
  }

  .hero-content {
    flex: 1;
  }

  .hero-visual {
    display: flex;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
    opacity: 1;
  }

  .hero-image-container {
    max-width: 100%;
    width: 100%;
  }

  .hero-title {
    font-size: 4rem;
  }

  /* Episodes Grid */
  .episodes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Global Player */
  .player-container {
    flex-wrap: nowrap;
  }

  .player-info {
    flex: 0 0 250px;
  }

  /* Episode Detail */
  .episode-player {
    padding: var(--space-2xl);
  }
}

/* ============================================
   EXTRA LARGE SCREENS
   ============================================ */

@media (min-width: 1280px) {
  :root {
    --container-padding: 2rem;
  }

  /* Hero */
  .hero-title {
    font-size: 5rem;
  }

  /* Episodes Grid */
  .episodes-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Featured */
  .featured-content {
    gap: var(--space-2xl);
  }

  .featured-image {
    width: 250px;
    height: 250px;
  }

  /* Footer */
  .footer-ascii {
    font-size: 0.6rem;
  }
}

/* ============================================
   ULTRA WIDE SCREENS
   ============================================ */

@media (min-width: 1536px) {
  :root {
    --container-max: 1600px;
  }

  .hero-title {
    font-size: 6rem;
  }

  .episodes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   HEIGHT-BASED ADJUSTMENTS
   ============================================ */

@media (max-height: 700px) {
  .hero {
    min-height: auto;
    padding-top: calc(60px + var(--space-xl));
    padding-bottom: var(--space-xl);
  }

  .scroll-indicator {
    display: none;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 48px;
    min-width: 48px;
  }

  .filter-btn {
    min-height: 40px;
    padding: var(--space-sm) var(--space-md);
  }

  .player-btn {
    min-width: 48px;
    min-height: 48px;
  }

  /* Disable hover effects on touch */
  .glitch-text:hover::before,
  .glitch-text:hover::after {
    animation: none;
    opacity: 0;
  }

  .episode-card:hover {
    transform: none;
  }

  .btn:hover::after {
    display: none;
  }

  /* Progress bar easier to tap */
  .progress-bar,
  .progress-bar-large {
    height: 12px;
    cursor: pointer;
  }

  .progress-handle,
  .progress-handle-large {
    width: 20px;
    height: 20px;
  }

  /* Volume slider taller */
  .volume-slider,
  .volume-slider-large {
    height: 8px;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .scanlines::before,
  .scanlines::after,
  .noise-overlay,
  #matrix-canvas,
  .main-nav,
  .global-player,
  .scroll-indicator,
  .filter-bar,
  .load-more-container {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .container {
    max-width: 100%;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
  }

  .episode-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  .btn {
    border: 1px solid black;
    background: transparent;
    color: black;
  }
}

/* ============================================
   LANDSCAPE PHONE
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: calc(60px + var(--space-md)) var(--container-padding) var(--space-md);
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-tagline {
    margin-bottom: var(--space-md);
  }

  .hero-cta {
    flex-direction: row;
    margin-bottom: var(--space-md);
  }

  .hero-stats {
    padding-top: var(--space-md);
  }

  .scroll-indicator {
    display: none;
  }

  .global-player .player-container {
    padding: var(--space-sm) var(--container-padding);
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-primary: #00ff00;
    --border-color: #444444;
  }

  .btn,
  .episode-card,
  .terminal-window {
    border-width: 2px;
  }
}

/* ============================================
   DARK MODE (ALREADY DEFAULT)
   ============================================ */

@media (prefers-color-scheme: light) {
  /* Site is dark by design - no changes needed */
}
