/* ==========================================================================
   RESPONSIVE STYLES
   Gioele Lombardi - Premium Web Development & Design
   ========================================================================== */

/* Tablet & Smaller Desktops (< 1024px) */
@media (max-width: 1024px) {
  .container {
    width: min(100% - 2.5rem, var(--container-width));
  }

  .project-inner-grid {
    min-width: 0;
  }

  .project-mockup-wrapper,
  .project-details-pane {
    min-width: 0;
  }

  .project-action-row {
    flex-wrap: wrap;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .nav-links,
  .nav-actions .btn {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-content {
    width: 100%;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

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

  .hero-visual {
    max-width: 580px;
    margin: 0 auto;
    width: 100%;
  }

  .hero-glass-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .manifesto-card {
    position: static;
    max-width: 600px;
  }

  .process-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .why-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .conversion-banner {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

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

  .project-inner-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .project-mockup-wrapper {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .showcase-header > *,
  .browser-header-bar > *,
  .project-inner-grid > *,
  .contact-grid > *,
  .footer-top > * {
    min-width: 0;
  }
}

/* Tablets & Large Mobile (< 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }

  .nav-links, .nav-actions .btn {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-trust-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .section-header,
  .section-subtitle {
    max-width: 100%;
  }

  .browser-header-bar {
    gap: 0.5rem;
  }

  .browser-address {
    max-width: 58%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .browser-content-canvas {
    min-height: 260px;
    height: auto;
    padding: 1.25rem;
  }

  .canvas-badge-row {
    gap: 0.5rem;
    align-items: flex-start;
  }

  .canvas-badge-row,
  .canvas-footer-stats {
    flex-wrap: wrap;
  }

  .project-action-row .btn {
    flex: 1 1 210px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    text-align: center;
    line-height: 1.25;
  }

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

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

  .cookie-banner {
    flex-direction: column;
    text-align: center;
    bottom: 1rem;
    padding: 1rem 1.25rem;
    gap: 1rem;
  }

  .cookie-actions {
    width: 100%;
    justify-content: center;
  }

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

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

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .floating-whatsapp-container {
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .floating-whatsapp-tooltip {
    display: none; /* Keep clean on small touch screens */
  }

  .channel-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .channel-card .btn {
    width: 100%;
  }

  .showcase-url-bar {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
  }

  .contact-form-card form > div[style*="grid-template-columns"] {
    min-width: 0;
  }

  .contact-form-card .form-group,
  .contact-form-card .form-input,
  .contact-form-card .form-select,
  .contact-form-card .form-textarea {
    min-width: 0;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
  .container {
    width: min(100% - 1.5rem, var(--container-width));
  }

  .hero-trust-bar {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero-trust-bar .trust-item {
    width: 100%;
    max-width: 18rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
  }

  .hero-trust-bar .trust-icon {
    margin-top: 0;
  }

  .hero-trust-bar .trust-text {
    align-items: center;
    max-width: 100%;
    text-align: center;
  }

  .browser-dots {
    display: none;
  }

  .browser-address {
    max-width: 78%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .canvas-hero-title {
    font-size: 1.25rem;
  }

  .project-details-pane {
    padding: 1.35rem;
  }
  .hero-trust-bar {
    grid-template-columns: 1fr;
  }

  .score-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .floating-badge {
    position: static;
    margin-top: 1rem;
  }

  .hero-glass-card {
    padding: 1.25rem;
  }

  .contact-direct-card, .contact-form-card {
    padding: 1.5rem;
  }

  .manifesto-card {
    padding: 1.5rem;
  }

  .portfolio-teaser-box {
    padding: 2.5rem 1.25rem;
  }

  .teaser-pillar-card {
    width: 100%;
    min-width: 0;
  }

  .showcase-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
  }

  .showcase-header .window-dots {
    display: none;
  }

  .showcase-header .showcase-url-bar {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    padding-inline: 0.65rem;
  }

  .showcase-header > div:last-child {
    grid-column: 2;
    grid-row: 1;
    white-space: nowrap;
  }

  .hero-glass-card,
  .hero-visual,
  .contact-direct-card,
  .contact-form-card,
  .project-item,
  .card-glass {
    max-width: 100%;
    min-width: 0;
  }

  .hero-content {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .hero-title,
  .hero-subtitle {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .hero-actions {
    align-items: center;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions .btn {
    width: min(100%, 22rem);
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .contact-form-card form > div[style*="grid-template-columns"],
  .contact-form-card form > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 390px) {
  .hero-title {
    font-size: clamp(2.15rem, 10vw, 2.6rem);
  }

  .project-classification-badge {
    font-size: 0.62rem;
    letter-spacing: 0.03em;
  }

  .project-action-row .btn {
    flex-basis: 100%;
  }

  .showcase-url-bar {
    font-size: 0.64rem;
  }

  .floating-whatsapp-container {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}

@media (max-width: 359px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .hero-glass-card {
    padding: 1rem;
  }

  .hero-actions .btn {
    width: 100%;
    font-size: 0.82rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .showcase-header > div:last-child {
    font-size: 0.62rem !important;
  }
}

/* Prevent long labels and inline grid children from creating horizontal overflow. */
@media (max-width: 767px) {
  .btn,
  .service-cta-link,
  .project-category,
  .project-classification-badge,
  .channel-value,
  .footer-contact-item,
  .form-label {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .contact-form-card form > div[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
