/* ==========================================================================
   EL CELLER SECRET — RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   Adaptació editorial meticulosa per a mòbil, tauleta i escriptori
   ========================================================================== */

/* --- TABLETS & MEDIUM SCREENS (<= 1024px) --- */
@media (max-width: 1024px) {
  :root {
    --header-offset: 105px;
  }

  .site-header {
    padding: 0.85rem var(--gutter) 0.6rem;
  }

  /* Transition desktop row navigation into dedicated subnav to prevent collisions */
  .header-nav {
    display: none;
  }

  .mobile-subnav {
    display: block;
  }

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

  .creation-card:last-child {
    grid-column: span 2;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }

  .instagram-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
  }
}

/* --- MOBILE PHABLETS & PHONES (<= 768px) --- */
@media (max-width: 768px) {
  :root {
    --section-pad-y: clamp(4rem, 12vw, 6rem);
    --gutter: 1.25rem;
    --header-offset: 105px;
  }

  .site-header {
    padding: 0.8rem var(--gutter) 0.55rem;
  }

  .brand-logo-img {
    height: 48px;
    max-width: 200px;
  }

  .header-actions {
    gap: 0.45rem;
  }

  .lang-selector {
    padding: 0.14rem 0.25rem;
    gap: 0.1rem;
  }

  .lang-btn {
    font-size: 0.66rem;
    padding: 0.18rem 0.35rem;
  }

  .header-instagram-nav-btn {
    font-size: 0.72rem;
    padding: 0.28rem 0.65rem;
  }

  /* Subnav chips with icon and graceful text handling */
  .mobile-subnav-track {
    gap: 0.3rem;
  }

  .mobile-nav-chip {
    font-size: 0.74rem;
    padding: 0.35rem 0.6rem;
    gap: 0.3rem;
  }

  .mobile-nav-chip .nav-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }

  .mobile-nav-chip span:not(.subnav-divider) {
    display: inline-block;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  /* Back to Top button on Mobile */
  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    height: 44px;
    width: 44px;
    padding: 0;
  }

  .back-to-top-text {
    display: none; /* Keep strictly minimal circular button on mobile */
  }

  .back-to-top:hover .back-to-top-text {
    display: none;
  }

  /* Hero Section */
  .hero-section {
    padding-top: 7rem;
    padding-bottom: 5rem;
    min-height: 100svh;
  }

  .hero-headline {
    font-size: clamp(2.4rem, 10vw, 3.8rem);
    line-height: 1.08;
  }

  .hero-subtitle {
    font-size: clamp(1.15rem, 4.5vw, 1.45rem);
    margin-bottom: 2.2rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.85rem;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 320px;
    flex: 1 1 auto;
    height: 52px;
    padding: 0 1rem;
  }

  .hero-scroll-indicator {
    display: none;
  }

  /* Manifesto Section */
  .manifesto-lead {
    font-size: clamp(2.1rem, 7.5vw, 3rem);
  }

  .manifesto-paragraph {
    font-size: clamp(1.2rem, 4.2vw, 1.45rem);
    line-height: 1.6;
  }

  .manifesto-quote-card {
    padding: 1.75rem 1.25rem;
  }

  /* Project Creation (Cards) */
  .creation-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .creation-card:last-child {
    grid-column: auto;
    max-width: 100%;
  }

  .creation-card-media {
    aspect-ratio: 16 / 11;
  }

  /* Experience Section */
  .experience-title-lead {
    font-size: clamp(1.9rem, 7vw, 2.6rem);
    text-align: left;
    margin-bottom: 2.5rem;
  }

  .experience-statement-item {
    gap: 1rem;
    padding: 1.2rem 0;
  }

  .experience-bullet {
    font-size: 1.1rem;
    min-width: 24px;
  }

  .experience-phrase {
    font-size: clamp(1.2rem, 4.5vw, 1.55rem);
    line-height: 1.4;
  }

  .experience-closing-banner {
    padding: 2.2rem 1.25rem;
  }

  /* Instagram Grid */
  .instagram-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .instagram-post-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(13, 12, 12, 0.95) 0%, rgba(13, 12, 12, 0.6) 45%, rgba(13, 12, 12, 0.1) 100%);
    padding: 0.85rem 0.75rem;
  }

  .post-overlay-caption {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  .post-overlay-tag {
    font-size: 0.68rem;
    margin-top: 0.2rem;
  }

  /* Newsletter Section */
  .newsletter-card-wrap {
    padding: 2.5rem 1.25rem;
  }

  .newsletter-form {
    flex-direction: column;
    gap: 0.85rem;
  }

  .newsletter-form .btn {
    width: 100%;
    padding: 1.1rem 1.5rem;
  }

  /* Footer & Location */
  .footer-location-container {
    padding: 1.35rem 1.1rem;
    gap: 1rem;
  }

  .footer-location-details {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .footer-location-separator {
    display: none;
  }

  .footer-btn-direction {
    width: 100%;
    justify-content: center;
    padding: 0.9rem 1.4rem;
  }

  .footer-bottom-bar {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
}

/* --- COMPACT MOBILE (<= 480px) --- */
@media (max-width: 480px) {
  .brand-logo-img {
    height: 42px;
    max-width: 175px;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .lang-selector {
    padding: 0.12rem 0.25rem;
    gap: 0.08rem;
  }

  .lang-btn {
    font-size: 0.64rem;
    padding: 0.15rem 0.3rem;
  }

  .lang-divider {
    font-size: 0.55rem;
  }

  .header-instagram-nav-btn {
    font-size: 0.68rem;
    padding: 0.25rem 0.55rem;
    gap: 0.25rem;
  }

  /* Mostra la icona i retalla el text amb punts suspensius elegants */
  .mobile-nav-chip {
    padding: 0.3rem 0.52rem;
    font-size: 0.72rem;
    gap: 0.25rem;
  }

  .mobile-nav-chip span:not(.subnav-divider) {
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .subnav-divider {
    margin: 0 0.05rem;
    opacity: 0.3;
  }

  .hero-headline {
    font-size: clamp(2.2rem, 9vw, 2.8rem);
  }
  
  .btn {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
  }
  
  .instagram-grid {
    grid-template-columns: 1fr;
  }
}

/* --- ULTRA NARROW MOBILE (<= 380px) --- */
@media (max-width: 380px) {
  .site-header {
    padding: 0.65rem 0.75rem 0.45rem;
  }

  .brand-logo-img {
    height: 35px;
    max-width: 145px;
  }

  /* Icona destacada + primeres lletres del text (ex: "Sec…", "Vin…", "Exp…", "Dia…", "VIP", "Som") */
  .mobile-nav-chip {
    padding: 0.28rem 0.45rem;
    gap: 0.2rem;
  }

  .mobile-nav-chip .nav-icon {
    width: 12px;
    height: 12px;
  }

  .mobile-nav-chip span:not(.subnav-divider) {
    max-width: 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
  }

  .header-instagram-nav-btn {
    padding: 0.22rem 0.45rem;
  }

  .header-instagram-nav-btn span:not(.nav-arrow) {
    display: none;
  }

  .header-instagram-nav-btn::before {
    content: "IG";
    font-size: 0.68rem;
    font-weight: 500;
  }
}

/* --- EXTREME NARROW VIEWPORT (<= 340px) --- */
@media (max-width: 340px) {
  .brand-logo-img {
    height: 30px;
    max-width: 125px;
  }

  .mobile-nav-chip span:not(.subnav-divider) {
    max-width: 36px;
  }
}

/* --- ACCESSIBILITY & PREFERS 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;
  }
  
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .reveal-text-mask > * {
    transform: none !important;
    opacity: 1 !important;
  }
}
