/* ============================================================
   KING TOMATO — responsive.css
   Breakpoints: mobile (≤480) | tablet (≤768) | laptop (≤1024)
   ============================================================ */

/* ─────────────────────────────────────────
   LAPTOP (≤1280px)
───────────────────────────────────────── */
@media (max-width: 1280px) {
  .data-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .footer-links-col {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .service-card-inner {
    grid-template-columns: 40px 200px 1fr auto;
    gap: 1.5rem;
  }
}

/* ─────────────────────────────────────────
   TABLET (≤1024px)
───────────────────────────────────────── */
@media (max-width: 1024px) {

  /* Navbar */
  .nav-links {
    display: none;
  }

  /* Hero */
  .hero-word {
    font-size: clamp(4rem, 12vw, 10rem);
  }

  .hero-text-track {
    width: 350vw;
  }

  /* Mission */
  .mission-collage {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }

  /* Services */
  .services-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .services-headline {
    text-align: left;
  }

  .service-card-inner {
    grid-template-columns: 40px 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .service-tags {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  /* Portfolio */
  .portfolio-container {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
  }

  /* Cinematic */
  .cinematic-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cin-grid-main {
    grid-column: 1 / -1;
    grid-row: 1;
    aspect-ratio: 16/7;
  }

  /* Data */
  .data-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Pricing */
  .pricing-body {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .pricing-plans {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .pricing-plan {
    flex: 1 1 280px;
  }

  /* Prevent overflow at tablet sizes */
  body, html {
    overflow-x: clip;
  }

  /* Contact */
  .contact-content {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .contact-form-card {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 1.8rem;
  }

  .contact-right {
    width: 100%;
  }

  .contact-form {
    gap: 1rem;
  }

  .form-textarea {
    height: 80px;
    min-height: 80px;
  }

  /* Services - prevent overflow */
  .service-card-inner {
    padding: 1.5rem var(--gutter);
  }

  .service-img-wrap {
    max-width: 100%;
    max-height: 200px;
    overflow: hidden;
  }

  .service-desc {
    font-size: 0.9rem;
  }

  .service-tag {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }

  /* Data Cards */
  .data-card {
    height: 300px;
  }

  .data-card-back p {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .data-card-desc {
    font-size: 0.75rem;
  }

  /* Pricing / FAQ */
  .pricing-faq-column {
    width: 100%;
    align-items: center;
  }

  .faq-item-box {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1.5rem 1.2rem;
  }

  .faq-footer {
    position: relative;
    left: auto;
    margin-left: 0;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .pricing-rotating-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  /* Team */
  .team-photos-stack {
    max-width: 55vw;
    max-height: 70vw;
  }

  /* Footer */
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-phrase {
    grid-column: 1 / -1;
  }
}

/* ─────────────────────────────────────────
   TABLET (≤768px)
───────────────────────────────────────── */
@media (max-width: 768px) {

  :root {
    --gutter: 1.5rem;
    --section-pad: 4rem;
  }

  /* Prevent global overflow */
  body, html {
    overflow-x: clip;
  }

  /* Navbar */
  .navbar {
    padding: 1rem var(--gutter);
  }

  .nav-logo-img {
    height: 32px;
  }

  /* Sidebar */
  .sidebar {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height to prevent gaps at bottom */
    transform: translateY(-100%);
    background: #0b0b0b; /* Dark black background */
    transition: transform 0.6s cubic-bezier(0.76, 0, 0.24, 1);
    z-index: 999; /* Ensure it covers everything */
  }

  body.sidebar-open .sidebar {
    transform: translateY(0);
  }

  body.sidebar-open .page-wrapper {
    transform: none !important;
  }

  body.sidebar-open .viewport-mask {
    display: none !important;
  }

  .sidebar-inner {
    padding-top: 5rem;
    justify-content: center;
  }

  .sidebar-close {
    top: 1.5rem;
    right: 1.5rem;
    left: auto;
    transform: none !important;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }

  body.sidebar-open .sidebar-close:hover {
    transform: scale(1.05) !important;
  }

  /* Hero */
  .hero-word {
    font-size: clamp(3rem, 12vw, 6rem);
  }

  .hero-pill {
    width: clamp(50px, 10vw, 80px);
    height: clamp(50px, 10vw, 80px);
  }

  .hero-tagline {
    bottom: 2rem;
    font-size: 0.8rem;
    padding: 0 1rem;
    text-align: center;
  }

  /* Mission box */
  .mission-section {
    background: #ffffff !important;
  }
  .mission-box-bg {
    background: #ffffff !important;
  }
  .mission-box {
    padding: 2rem 1rem;
    margin: 0;
    height: auto !important;
    min-height: 60vh;
  }

  .mission-text {
    font-size: clamp(1.2rem, 5vw, 2rem);
    line-height: 1.4;
  }

  .mission-small-text {
    font-size: clamp(0.5rem, 2.2vw, 0.9rem) !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    text-align: center;
    max-width: 35vw !important; /* scale max-width dynamically to fit box */
  }

  .mission-contact-btn {
    font-size: clamp(0.6rem, 2.5vw, 1rem) !important;
    padding: 0.5em 1em !important;
    transform: translateY(-0.2em) !important;
    margin: 0 0.3rem;
  }

  /* Services */
  .services-section {
    padding-top: 2rem;
  }

  .services-headline {
    font-size: clamp(1.8rem, 6vw, 3rem);
  }

  .service-card {
    height: auto;
    min-height: 100vh;
    position: sticky;
    background: var(--dark) !important;
  }
  
  /* Ajuste de pines para empezar el recorrido sticky casi desde arriba en móvil */
  .service-card:nth-child(1) { top: 0vh; }
  .service-card:nth-child(2) { top: 3vh; }
  .service-card:nth-child(3) { top: 6vh; }
  .service-card:nth-child(4) { top: 9vh; }
  /* Al eliminar el margin-bottom de escritorio cerramos el hueco donde se filtraba la 4ta tarjeta */
  .service-card:nth-child(5) { top: 12vh; margin-bottom: 0 !important; }

  .service-card-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    align-items: flex-start;
    padding: 2rem var(--gutter);
  }

  .service-num {
    writing-mode: horizontal-tb;
  }

  .service-img-wrap {
    max-width: 100%;
    height: 220px;
  }

  .service-tags {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .pills-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .service-tag {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
  }

  /* Descubre / Morph Dummy */
  #servicesCurtain {
    display: none !important;
  }

  .morph-dummy-space {
    height: 0 !important;
    display: none !important;
  }
  
  .discover-section {
    margin-top: 0 !important;
    padding: 3rem var(--gutter) 2rem !important;
  }
  
  .discover-title {
    font-size: 2.5rem;
  }
  
  .discover-subtitle {
    font-size: 0.85rem;
    width: min-content;
    text-align: right;
    line-height: 1.1;
  }

  /* Bottom Floating Navbar */
  .bottom-nav {
    padding: 0.5rem 1rem;
    gap: 0.8rem;
    width: auto;
    max-width: 95vw;
    justify-content: center;
    bottom: 1rem;
  }
  
  .bottom-nav-link {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }
  
  .bottom-nav-logo {
    display: flex !important;
  }
  .bottom-nav-logo img {
    height: 24px !important;
    width: auto !important;
    min-width: 24px;
    object-fit: contain;
  }

  /* Portfolio */
  .portfolio-container {
    grid-template-columns: 1fr;
  }

  .portfolio-wrapper {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    border-radius: 24px !important;
    overflow: visible !important;
    margin-top: 0 !important;
  }

  .morph-dummy-space {
    display: none !important;
  }

  .portfolio-project {
    height: 50vh !important;
    background: transparent !important;
  }

  .project-bg-wrap {
    background: transparent !important;
  }

  .project-center-box {
    width: 85% !important;
    padding: 0.6rem 0.3rem 0.3rem 0.3rem !important;
    border-radius: 14px !important;
  }

  .project-frame-header {
    margin-bottom: 0.5rem !important;
    padding: 0 0.5rem !important;
    gap: 0.3rem !important;
  }

  .project-tag, .project-category, .project-date {
    font-size: 0.5rem !important;
  }

  .project-inner-img-wrap {
    border-radius: 10px !important;
  }

  .pricing-container {
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    gap: 1.5rem !important;
  }

  .pricing-section {
    padding: 3rem var(--gutter) !important;
  }

  .pricing-column {
    gap: 1rem !important;
  }

  .plan-box {
    padding: 1.2rem 1rem !important;
  }

  .plan-price {
    font-size: clamp(1.8rem, 7vw, 2.5rem) !important;
  }

  .plan-desc {
    font-size: 0.8rem !important;
  }

  .plan-features-list li {
    font-size: 0.8rem !important;
  }

  .plan-cta-btn {
    font-size: 0.9rem !important;
    padding: 0.8rem 1.5rem !important;
  }

  .pricing-faq-column {
    gap: 0.8rem !important;
    width: 100% !important;
    align-items: center !important;
    margin-top: 1.5rem !important;
  }

  .faq-item-box {
    padding: 1rem 1rem !important;
    width: 100% !important;
    max-width: 90vw !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }

  .faq-question-text {
    font-size: 0.8rem !important;
  }

  .faq-answer {
    font-size: 0.75rem !important;
    padding: 0.5rem 0 !important;
  }

  .faq-footer {
    position: relative !important;
    left: auto !important;
    margin-left: 0 !important;
    margin-top: 1.5rem !important;
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    font-size: 0.8rem !important;
  }

  .portfolio-section {
    padding: 3rem var(--gutter);
  }

  /* Cinematic */
  .cinematic-hero-wrap {
    height: 50vh;
  }

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

  .cin-grid-main {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: 16/9;
  }

  /* Data */
  .data-cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .data-card {
    height: 280px;
  }

  /* Testimonials */
  .testimonials-stack {
    height: auto;
  }

  .testimonial-card {
    position: relative;
    inset: auto;
    opacity: 1;
    transform: none;
  }

  .testimonial-card:not(:first-child) {
    display: none;
  }

  /* Team */
  .team-section {
    height: 80vh;
  }

  /* Pricing */
  .pricing-title {
    font-size: clamp(3rem, 14vw, 6rem);
  }

  .pricing-rotating-title {
    font-size: clamp(2rem, 9vw, 3rem) !important;
  }

  .pricing-plans {
    flex-direction: column;
  }

  .pricing-plan {
    flex: none;
  }

  /* Contact */
  .contact-section {
    padding: 2rem 0 !important;
  }

  .contact-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
    padding: 2rem var(--gutter) !important;
  }

  .contact-title {
    font-size: clamp(1.8rem, 7vw, 3rem) !important;
  }

  .contact-subtitle {
    font-size: 0.9rem !important;
  }

  .contact-form-card {
    max-width: 100% !important;
    width: 100% !important;
    padding: 1.5rem 1rem !important;
    box-sizing: border-box !important;
  }

  .contact-right {
    width: 100% !important;
  }

  .form-name-row {
    flex-direction: column !important;
    gap: 0.8rem !important;
  }

  .form-input {
    font-size: 0.85rem !important;
    padding: 0.7rem 0.8rem !important;
  }

  .form-label {
    font-size: 0.7rem !important;
  }

  .form-submit {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
  }

  /* Footer */
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 3rem var(--gutter) 2rem;
  }

  .footer-phrase {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
  }

  .footer-links-col {
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: flex-start;
  }

  .footer-brand-name {
    font-size: clamp(1.5rem, 8vw, 4rem);
  }

  /* Team Section Mobile */
  .team-photos-stack {
    max-width: 45vw !important;
    max-height: 60vw !important;
  }

  .team-bg-text {
    top: 50% !important;
  }

  /* Contact Form Height Adjustments */
  .contact-form {
    gap: 0.7rem !important;
  }

  .form-group {
    gap: 0.3rem !important;
  }

  .form-textarea {
    height: 60px !important;
    min-height: 60px !important;
  }

  .form-name-row {
    gap: 0.5rem !important;
  }

  .contact-form-card {
    padding: 1rem !important;
  }
}

/* ─────────────────────────────────────────
   MOBILE (≤480px)
───────────────────────────────────────── */
@media (max-width: 480px) {

  :root {
    --gutter: 1.2rem;
    --section-pad: 3rem;
  }

  /* Splash */
  .splash-logo {
    width: 55vw;
  }

  /* Navbar */
  .nav-logo-img {
    height: 28px;
  }

  /* Hero */
  .hero-word {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }

  .hero-text-track {
    width: 250vw;
    gap: 2vw;
  }

  .hero-pill {
    width: 50px;
    height: 50px;
  }

  .hero-tagline {
    font-size: 0.7rem;
    padding: 0 1rem;
    text-align: center;
  }

  /* Mission */
  .mission-collage {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, 1fr);
  }

  .mission-box {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 0 0.5rem;
  }

  /* Services Section */
  .services-section {
    padding-top: 3rem;
  }
  
  .services-header {
    margin-bottom: 2rem;
  }

  .services-label {
    position: static !important;
    display: block;
    margin-bottom: 1rem;
    text-align: center;
  }

  .services-headline {
    font-size: clamp(2rem, 8vw, 3rem);
    margin-bottom: 1.5rem;
  }

  /* Services */
  .services-headline {
    font-size: clamp(1.2rem, 5vw, 2rem);
  }

  .service-title {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
  }

  /* Data */
  .data-cards-grid {
    flex-direction: column !important;
    gap: 1.5rem !important;
    align-items: center !important;
  }

  .data-card-clip {
    max-width: 100% !important;
    width: 100% !important;
    height: 220px;
  }

  .data-card {
    height: 220px;
  }

  .data-card-metric {
    font-size: 2rem !important;
  }

  .data-card-desc {
    font-size: 0.65rem !important;
    line-height: 1.3 !important;
  }

  .data-card-back {
    padding: 1rem 0.8rem !important;
  }

  .data-card-back p {
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    padding: 0 !important;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .data-card-front {
    padding: 0.8rem 0.8rem 1rem !important;
  }

  .data-card-top {
    gap: 0.3rem;
  }

  .data-card-title {
    font-size: 0.55rem !important;
  }

  /* Testimonials */
  .testi-heading {
    font-size: clamp(2rem, 10vw, 3rem) !important;
  }

  /* Partners */
  .partner-item {
    font-size: clamp(1.2rem, 5vw, 2rem);
    padding: 0 1rem;
  }

  /* Testimonials */
  .tc-quote {
    font-size: clamp(1rem, 3.5vw, 1.3rem);
  }

  /* Pricing top */
  .pricing-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  /* Portfolio */
  .portfolio-project {
    aspect-ratio: 3/2;
  }

  /* Form */
  .form-submit {
    width: 100%;
    justify-content: center;
  }

  /* Team */
  .team-headline {
    font-size: clamp(1.6rem, 6vw, 2.5rem);
  }

  /* Footer */
  .footer-socials {
    gap: 0.5rem;
  }

  .footer-social {
    width: 38px;
    height: 38px;
  }

  .footer-bottom {
    padding: 2.5rem var(--gutter) 2rem;
  }

  /* Footer mobile vertical layout */
  .footer-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3rem !important;
    padding: 3rem var(--gutter) 2rem !important;
  }

  .footer-left {
    gap: 2rem !important;
  }

  .footer-right {
    flex-direction: column !important;
    gap: 2rem !important;
    width: 100% !important;
  }

  .footer-links-col {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
}

/* ─────────────────────────────────────────
   ACCESSIBILITY: Reduced Motion
───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-tomato {
    animation: none;
  }

  .partners-marquee-track {
    animation: none;
  }

  .sidebar-cta {
    animation: none;
    background: var(--green);
  }
}

/* ─────────────────────────────────────────
   TOUCH DEVICES: Remove hover effects
───────────────────────────────────────── */
@media (hover: none) {
  .custom-cursor {
    display: none;
  }

  body {
    cursor: auto;
  }

  .data-card {
    cursor: pointer;
  }
}

/* ─────────────────────────────────────────
   HIGH DPI (Retina)
───────────────────────────────────────── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .splash-logo,
  .nav-logo-img,
  .sidebar-logo-bottom,
  .footer-logo-img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ─────────────────────────────────────────
   PRINT
───────────────────────────────────────── */
@media print {
  .splash-screen,
  .sidebar,
  .sidebar-overlay,
  .custom-cursor,
  .navbar {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}
button, a { cursor: pointer; }
