/* ============================================================
   RESPONSIVE.CSS — Media queries for mobile / tablet / desktop
   Klyo — The Enterprise AI Security Gateway
   ============================================================ */

/* ==========================================================
   TABLET  (max-width: 1024px)
   ========================================================== */
@media (max-width: 1024px) {
  :root {
    --space-5xl: 5rem;
  }

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

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

  .hero-inner {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    text-align: center;
  }

  .hero-description {
    max-width: none;
    margin-inline: auto;
  }

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

  .hero-visual {
    order: -1;
  }

  /* Stats: 2 cols */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Products: narrower on tablet */
  .product-showcase {
    max-width: 600px;
  }

  .product-features-grid {
    grid-template-columns: 1fr;
  }

  /* Capabilities: 2 cols */
  .capabilities-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Benefits: 1 col */
  .benefits-grid {
    grid-template-columns: 1fr;
  }

  /* Market stats: keep 3 cols but smaller */
  .market-stats {
    gap: var(--space-md);
  }

  /* Nerd cols: 1 col on tablet */
  .nerd-cols {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

  .footer-nav {
    justify-content: center;
  }

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


/* ==========================================================
   MOBILE  (max-width: 768px)
   ========================================================== */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
    --container-padding: 1.25rem;
    --space-5xl: 3.5rem;
    --space-4xl: 3rem;
    --space-3xl: 2rem;
  }

  /* --- Mobile Nav --- */
  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100dvh;
    background: var(--color-bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    padding: calc(var(--header-height) + var(--space-xl)) var(--space-xl) var(--space-xl);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    z-index: 999;
  }

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

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-link {
    display: block;
    padding: var(--space-md) 0;
    font-size: var(--text-base);
    border-bottom: 1px solid var(--color-border);
  }

  .nav-link::after {
    display: none;
  }

  .nav-list .btn {
    margin-top: var(--space-md);
    width: 100%;
  }

  .menu-toggle {
    display: flex;
  }

  /* Hide nerd label on mobile */
  .nerd-label {
    display: none;
  }

  /* Language dropdown on mobile */
  .lang-current {
    font-size: 0.65rem;
  }

  /* Mobile overlay */
  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
  }

  .nav-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  /* --- Hero --- */
  .hero {
    padding-top: calc(var(--header-height) + var(--space-2xl));
    padding-bottom: var(--space-3xl);
  }

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

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

  .hero-description {
    font-size: var(--text-base);
  }

  .hero-tagline {
    font-size: var(--text-xs);
  }

  /* Gateway diagram: vertical on mobile */
  .gateway-diagram {
    flex-direction: column;
  }

  .gw-arrow {
    width: 2px;
    height: 24px;
  }

  .gw-arrow::after {
    right: auto;
    top: auto;
    bottom: -1px;
    left: -4px;
    transform: rotate(45deg);
  }

  /* --- Stats: 1 col on small mobile --- */
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  /* --- Architecture flow: vertical --- */
  .arch-flow {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .arch-connector svg {
    transform: rotate(90deg);
  }

  .arch-box {
    min-width: auto;
    width: 100%;
    max-width: 240px;
  }

  /* --- Capabilities: 1 col --- */
  .capabilities-grid {
    grid-template-columns: 1fr;
  }

  /* --- Market: 1 col --- */
  .market-stats {
    grid-template-columns: 1fr;
  }

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

  /* Table */
  .comparison-table th,
  .comparison-table td {
    padding: 0.7rem 0.8rem;
    font-size: var(--text-xs);
  }

  /* --- FAQ --- */
  .faq-question {
    font-size: var(--text-sm);
  }

  /* --- Contact Form --- */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* --- Cookie Banner --- */
  .cookie-inner {
    flex-direction: column;
    text-align: center;
  }

  .cookie-actions {
    width: 100%;
  }

  .cookie-actions .btn {
    flex: 1;
  }

  /* --- Gateway arrows vertical: particle direction --- */
  .gw-arrow::before {
    animation-name: data-flow-vertical;
  }

  @keyframes data-flow-vertical {
    0%   { top: -5px; left: 50%; opacity: 0; }
    15%  { opacity: 0.8; }
    85%  { opacity: 0.8; }
    100% { top: calc(100% + 5px); left: 50%; opacity: 0; }
  }

  /* --- Section headings --- */
  .section-title {
    font-size: var(--text-2xl);
  }

  .section-subtitle {
    font-size: var(--text-base);
  }

  /* --- CTA --- */
  .cta-title {
    font-size: var(--text-2xl);
  }

  .cta-text {
    font-size: var(--text-base);
  }

  /* --- Footer --- */
  .footer-top {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-xl);
  }

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

  .footer-nav {
    flex-direction: column;
    gap: var(--space-xl);
    align-items: center;
  }

  .footer-col {
    text-align: center;
  }

  /* Logo sizing */
  .logo-emblem {
    width: 28px;
  }
}


/* ==========================================================
   SMALL MOBILE  (max-width: 480px)
   ========================================================== */
@media (max-width: 480px) {
  .hero-title {
    font-size: var(--text-2xl);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .benefit-block {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .header-toggles {
    margin-left: auto;
    margin-right: var(--space-sm);
  }
}


/* ==========================================================
   LARGE DESKTOP  (min-width: 1400px)
   ========================================================== */
@media (min-width: 1400px) {
  :root {
    --container-max: 1320px;
  }

  .hero-title {
    font-size: var(--text-6xl);
  }
}


/* ==========================================================
   RTL MOBILE OVERRIDES
   ========================================================== */
@media (max-width: 768px) {
  /* Mobile nav slides from left in RTL */
  [dir="rtl"] .main-nav {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  [dir="rtl"] .main-nav.open {
    transform: translateX(0);
  }

  /* Gateway diagram vertical is direction-agnostic, no change needed */

  /* Architecture flow vertical: arrows don't need flipping */
  [dir="rtl"] .arch-connector svg {
    transform: rotate(90deg) scaleX(-1);
  }
}

@media (max-width: 480px) {
  [dir="rtl"] .header-toggles {
    margin-right: auto;
    margin-left: var(--space-sm);
  }
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}
