/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/*
   Breakpoint Reference:
   - sm: 640px   (Mobile landscape)
   - md: 768px   (Tablet)
   - lg: 1024px  (Desktop)
   - xl: 1280px  (Large desktop)
   - 2xl: 1440px (Wide screens)
*/

/* ==========================================================================
   Mobile First - Base styles are mobile
   ========================================================================== */

/* Small devices (landscape phones, 640px and up) */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:hidden { display: none; }
  .sm\:block { display: block; }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:flex-row { flex-direction: row; }
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:flex { display: flex; }

  .masonry {
    column-count: 2;
  }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lg\:flex-row { flex-direction: row; }
  .lg\:hidden { display: none; }
  .lg\:block { display: block; }
  .lg\:flex { display: flex; }

  .masonry {
    column-count: 3;
  }
}

/* Extra large devices (large desktops, 1280px and up) */
@media (min-width: 1280px) {
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ==========================================================================
   Component Responsive Overrides
   ========================================================================== */

/* Navigation - Mobile */
@media (max-width: 1023px) {
  .navbar {
    padding: 0 var(--space-4);
  }

  .navbar__toggle {
    display: flex;
  }

  .navbar__menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-20) var(--space-6) var(--space-6);
    background: var(--color-primary);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform var(--duration-normal) var(--ease-out);
    overflow-y: auto;
    z-index: var(--z-modal);
  }

  .navbar.mobile-open .navbar__menu {
    transform: translateX(0);
  }

  .navbar__item {
    opacity: 0;
    transform: translateX(20px);
    transition: all var(--duration-normal) var(--ease-out);
  }

  .navbar.mobile-open .navbar__item {
    opacity: 1;
    transform: translateX(0);
  }

  .navbar__link {
    display: block;
    padding: var(--space-4);
    font-size: var(--text-lg);
    border-radius: var(--radius-lg);
  }

  .navbar__link.active::after {
    display: none;
  }

  .navbar__actions {
    display: none;
  }

  /* Mobile menu toggle animation */
  .navbar.mobile-open .navbar__toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .navbar.mobile-open .navbar__toggle span:nth-child(2) {
    opacity: 0;
  }

  .navbar.mobile-open .navbar__toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
}

/* Hero - Tablet and below */
@media (max-width: 1023px) {
  .hero {
    padding: var(--space-24) var(--space-4);
    min-height: auto;
  }

  .hero__title {
    font-size: var(--text-4xl);
  }

  .hero__description {
    font-size: var(--text-lg);
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .hero__scroll {
    display: none;
  }
}

/* Split layout - Tablet and below */
@media (max-width: 1023px) {
  .split-layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .split-layout--reverse .split-layout__content,
  .split-layout--reverse .split-layout__media {
    order: unset;
  }

  .split-layout__content {
    max-width: 100%;
    text-align: center;
  }
}

/* Timeline - Tablet and below */
@media (max-width: 1023px) {
  .timeline__line {
    left: 24px;
  }

  .timeline__item {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding-left: var(--space-16);
  }

  .timeline__item:nth-child(odd) .timeline__content,
  .timeline__item:nth-child(even) .timeline__content {
    grid-column: 1;
    text-align: left;
  }

  .timeline__item:nth-child(odd) .timeline__media,
  .timeline__item:nth-child(even) .timeline__media {
    grid-column: 1;
    grid-row: auto;
  }

  .timeline__dot {
    left: 24px;
  }
}

/* Footer - Tablet and below */
@media (max-width: 1023px) {
  .footer__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }

  .footer__brand {
    grid-column: span 2;
    max-width: 100%;
    text-align: center;
    margin-bottom: var(--space-4);
  }

  .footer__social {
    justify-content: center;
  }
}

/* Footer - Mobile */
@media (max-width: 639px) {
  .footer__grid {
    grid-template-columns: 1fr;
  }

  .footer__brand {
    grid-column: 1;
  }

  .footer__column {
    text-align: center;
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .footer__legal {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Cards grid - Mobile */
@media (max-width: 639px) {
  .grid-auto-fit,
  .grid-auto-fill {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Bento grid - Responsive */
@media (max-width: 1023px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento-item--large {
    grid-column: span 2;
    grid-row: span 1;
  }
}

@media (max-width: 639px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-item--large,
  .bento-item--wide {
    grid-column: span 1;
  }
}

/* Stats - Mobile */
@media (max-width: 639px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat {
    padding: var(--space-4);
  }

  .stat__value {
    font-size: var(--text-3xl);
  }
}

/* Carousel navigation - Mobile */
@media (max-width: 639px) {
  .carousel__nav {
    width: 40px;
    height: 40px;
  }

  .carousel__nav--prev {
    left: var(--space-2);
  }

  .carousel__nav--next {
    right: var(--space-2);
  }
}

/* Tabs - Mobile */
@media (max-width: 639px) {
  .tabs {
    flex-direction: column;
  }

  .tab {
    width: 100%;
    text-align: center;
  }
}

/* Modal - Mobile */
@media (max-width: 639px) {
  .modal {
    padding: var(--space-2);
  }

  .modal__container {
    max-height: 95vh;
    border-radius: var(--radius-xl);
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: var(--space-4);
  }
}

/* Form - Mobile */
@media (max-width: 639px) {
  .form-input,
  .form-textarea,
  .form-select {
    padding: var(--space-3);
    font-size: var(--text-base);
  }
}

/* Section spacing - Mobile */
@media (max-width: 639px) {
  .section {
    padding: var(--space-16) 0;
  }

  .section__header {
    margin-bottom: var(--space-10);
  }

  .section__title {
    font-size: var(--text-3xl);
  }
}

/* ==========================================================================
   Utility Responsive Helpers
   ========================================================================== */

/* Text alignment responsive */
@media (max-width: 1023px) {
  .lg\:text-left { text-align: left; }
  .lg\:text-center { text-align: center; }
}

@media (max-width: 767px) {
  .md\:text-center { text-align: center; }
}

/* Spacing responsive overrides */
@media (max-width: 767px) {
  .md\:mb-8 { margin-bottom: var(--space-8); }
  .md\:mt-8 { margin-top: var(--space-8); }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  .navbar,
  .hero__scroll,
  .footer__social,
  .carousel__nav,
  .carousel__pagination {
    display: none !important;
  }

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

  .section {
    padding: 2rem 0;
    page-break-inside: avoid;
  }

  img {
    max-width: 100% !important;
  }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
  :root {
    --border-color: rgba(0, 0, 0, 0.3);
    --border-color-hover: rgba(0, 0, 0, 0.5);
  }

  .btn--primary {
    border: 2px solid var(--color-accent-dark);
  }

  .card {
    border-width: 2px;
  }

  .navbar__link {
    border: 1px solid transparent;
  }

  .navbar__link:focus,
  .navbar__link:hover {
    border-color: var(--color-accent);
  }
}

/* ==========================================================================
   Theme Note
   VocSeed uses a light theme by default.
   ========================================================================== */
