/* 
  Most responsive behavior is built mobile-first into layout.css and components.css 
  using CSS Grid, Flexbox, and clamp(). This file contains any specific overrides. 
*/

/* Let grid/flex children shrink to their available width, including long content. */
.grid > *, .form-row > *, .contact-grid > *, .ci-card > *,
.event-details-grid > *, .misconnect-grid > *, .footer-grid > * {
  min-width: 0;
}

main, .site-footer, .modal-content {
  overflow-wrap: anywhere;
}

input, select, textarea, iframe {
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 1200px) {
  .site-header {
    top: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .navbar { gap: 1rem; }
  .brand { min-width: 0; flex-shrink: 1; }
  .menu-button { min-width: 44px; min-height: 44px; flex-shrink: 0; }

  /* The blurred header is the containing block: anchor to its actual height. */
  .nav-menu {
    position: absolute;
    top: 100%;
    height: calc(100vh - var(--navigation-height, 66px));
    height: calc(100dvh - var(--navigation-height, 66px));
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overscroll-behavior: contain;
    visibility: hidden;
    pointer-events: none;
  }

  .nav-menu.is-open { visibility: visible; pointer-events: auto; }
  .nav-menu .nav-submenu { min-width: 0; }
  .nav-menu .nav-item.is-open > .nav-submenu { max-height: none; }
  .nav-menu a, .nav-menu .nav-toggle { white-space: normal; overflow-wrap: anywhere; }
  .nav-menu svg { flex-shrink: 0; }
}

@media (max-width: 768px) {
  /* Hero Overrides */
  .hero {
    text-align: center;
    padding-top: var(--space-xl);
  }

  .hero__actions {
    justify-content: center;
  }
  
  .hero__actions .btn {
    width: 100%;
  }
  
  /* Modal responsive */
  .modal-content {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  /* Marquee fade effect */
  .marquee-edge-fade {
    display: none !important;
  }

  /* Header & Footer Edge-to-Edge on Mobile */
  .site-header {
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
  }

  .site-footer {
    width: 100% !important;
    margin: 40px 0 0 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
  }

  /* Sponsorluk Page MTKB Card */
  .mtkb-card {
    padding: 1.5rem !important;
    gap: 1.5rem !important;
  }
  
  .mtkb-card-content {
    gap: 1.5rem !important;
  }

  .mtkb-logos {
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .mtkb-divider {
    width: 60px !important;
    height: 1px !important;
  }

  /* Universal Section Padding adjustments */
  .section {
    padding-block: calc(var(--space-section) * 0.6) !important;
  }

  /* Grid adjustments for cards (force 1 column) */
  .grid--2, .grid--3, .grid--4 {
    grid-template-columns: 1fr !important;
  }
  
  /* Form stepper adjustments for mobile */
  .stepper-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.35rem;
    position: relative;
    margin: 0 auto 2.5rem;
    padding-bottom: 0;
  }
  
  .stepper-line {
    display: block;
    position: absolute;
    top: 16px;
    left: 16%;
    right: 16%;
    height: 2px;
    background: var(--color-border);
    z-index: 0;
  }

  .stepper-container:has(.step:nth-of-type(4)) .stepper-line {
    left: 12%;
    right: 12%;
  }
  
  .step {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
  }
  
  .step-circle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
  }
  
  .step-label {
    font-size: 0.75rem;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: break-word;
    max-width: 100%;
    text-align: center;
  }
  
  .form-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
  
  /* Contact Page adjustments */
  .contact-grid {
    grid-template-columns: 1fr !important;
  }
  
  .ci-card-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  
  /* Typography overrides */
  h1 { font-size: clamp(2rem, 8vw, 2.5rem) !important; }
  h2 { font-size: clamp(1.75rem, 6vw, 2rem) !important; }
  
  .form-card {
    padding: 1.5rem !important;
  }

  .btn, .btn-next, .btn-prev {
    max-width: 100%;
    min-height: 44px;
    white-space: normal;
    text-align: center;
  }

  .contact-form-box, .sitemap-section { padding: 1.5rem; }
  .cf-input, .cf-textarea, .form-input, .form-select { font-size: 1rem; }
  .site-footer { padding: 2rem 0 1.5rem; }
  .footer-meta > div { width: 100%; flex-basis: auto !important; }
  .footer-meta > div:last-child { justify-content: flex-start !important; }
  .event-sidebar-card { position: static; padding: 1.5rem; }
  .event-hero { height: auto; aspect-ratio: 16 / 10; }
  .modal-content { height: 100dvh; max-height: 100dvh; padding: 3.5rem 1.25rem 1.25rem; }
  .modal-body { max-height: calc(100dvh - 4.75rem); padding-right: 0.5rem; }
  .modal-close { width: 44px; height: 44px; }
  .marquee-card { min-width: 0 !important; width: calc(100vw - 2rem); padding: 1.5rem !important; }
}

@media (max-width: 480px) {
  .cf-captcha-group { grid-template-columns: minmax(0, 1fr); }
  .form-actions { flex-wrap: wrap; gap: 1rem; }
  .form-actions > button { flex: 1 1 100%; }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem !important;
  }
  .stat-item {
    padding: 1.5rem 1rem !important;
  }
  .stat-value {
    font-size: 2rem !important;
  }
  .stat-label {
    font-size: 0.8rem !important;
  }

  /* Newsletter form */
  .newsletter-form {
    flex-direction: column !important;
  }
  
  .newsletter-form input,
  .newsletter-form button {
    width: 100% !important;
  }
}
