/* =========================================================
   HUGO STUDIO · CASOS DE ESTUDIO RESPONSIVE V30
   Compartido por todas las páginas de proyecto.
   Solo modifica tablet y móvil; escritorio queda intacto.
   ========================================================= */

@media (max-width: 1024px) {
  :root {
    --project-gutter: clamp(18px, 4vw, 34px);
  }

  html {
    scroll-padding-top: 102px;
  }

  body {
    overflow-x: hidden;
  }

  .navbar {
    top: 12px;
    width: calc(100% - 24px);
    min-height: 74px;
    padding: 10px 12px 10px 18px;
    grid-template-columns: 84px 1fr auto;
    gap: 12px;
    border-radius: 30px;
  }

  .brand {
    width: 64px;
    height: 46px;
  }

  .brand img {
    height: 40px;
  }

  .nav-cta {
    display: none;
  }

  .menu-button {
    display: grid;
    justify-self: end;
    width: 48px;
    height: 48px;
    place-content: center;
    gap: 7px;
    border-radius: 50%;
    background: #2f6bff;
    color: #fff;
    box-shadow: 0 10px 24px rgba(47,107,255,.24);
  }

  .menu-button span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    background: rgba(12,12,14,.985);
    box-shadow: 0 24px 54px rgba(0,0,0,.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px) scale(.985);
    transform-origin: top center;
    transition: opacity 220ms ease, transform 280ms cubic-bezier(.22,1,.36,1), visibility 220ms ease;
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-links a {
    min-height: 48px;
    padding: 0 16px;
    justify-content: flex-start;
    border-radius: 14px;
    font-size: .94rem;
    opacity: .86;
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links a:hover,
  .nav-links a:focus-visible,
  .nav-links a[aria-current="page"] {
    background: rgba(255,255,255,.08);
    transform: none;
    opacity: 1;
  }

  .nav-links .mobile-nav-cta {
    margin-top: 4px;
    justify-content: center;
    background: #2f6bff;
    color: #fff;
    font-weight: 750;
    opacity: 1;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  /* Reordena el caso de estudio sin cambiar el HTML ni escritorio. */
  .project-layout {
    width: calc(100% - (var(--project-gutter) * 2));
    max-width: 1040px;
    margin: 0 auto;
    padding: 118px 0 72px;
    display: grid;
    grid-template-columns: minmax(250px, .82fr) minmax(0, 1.18fr);
    grid-template-areas:
      "intro intro"
      "profile profile"
      "preview gallery";
    align-items: start;
    gap: 24px 20px;
  }

  .content-column {
    display: contents;
  }

  .project-intro {
    grid-area: intro;
    width: 100%;
    max-width: 900px;
    margin: 0 0 2px;
  }

  .project-intro h1 {
    font-size: clamp(3.2rem, 8vw, 5.2rem);
  }

  .project-category {
    max-width: 720px;
    font-size: 1rem;
  }

  .project-description {
    max-width: 800px;
    font-size: .98rem;
    line-height: 1.65;
  }

  .profile-header {
    grid-area: profile;
    width: 100%;
    margin: 0;
    padding: 24px;
    flex-direction: row;
    align-items: center;
    gap: 18px;
  }

  .profile-main {
    flex-direction: row;
    align-items: center;
    min-width: 0;
  }

  .profile-main > img,
  .profile-brand {
    flex: 0 0 auto;
  }

  .profile-name-row h2,
  .profile-main h2 {
    overflow-wrap: anywhere;
  }

  .profile-meta {
    justify-content: flex-start;
  }

  .preview-column {
    grid-area: preview;
    position: sticky;
    top: 102px;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    align-self: start;
  }

  .preview-stage,
  .insta-preview-card,
  .photo-preview-card,
  .art-preview-card {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 5;
    border-radius: 24px;
  }

  .preview-panel,
  .instagram-shell,
  .insta-preview-shell,
  .photo-preview-card,
  .art-preview-card {
    min-height: 0 !important;
  }

  .preview-status,
  .photo-counter,
  .art-counter {
    margin-top: 12px;
    font-size: .75rem;
  }

  .preview-note {
    margin: 9px 0 0;
    font-size: .76rem;
    line-height: 1.45;
  }

  .portfolio-grid,
  .instagram-grid,
  .photo-grid,
  .project-grid {
    grid-area: gallery;
    align-self: start;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .grid-card {
    min-width: 0;
    min-height: 0 !important;
    aspect-ratio: 4 / 5;
    border-radius: 18px;
  }

  .grid-kind {
    top: 7px;
    right: 7px;
    min-height: 23px;
    padding: 0 7px;
    font-size: .54rem;
  }

  .grid-title {
    left: 7px;
    bottom: 7px;
    min-height: 27px;
    padding: 0 9px;
    font-size: .62rem;
  }
}

@media (max-width: 640px) {
  :root {
    --project-gutter: 16px;
  }

  .navbar {
    width: calc(100% - 20px);
    min-height: 70px;
    grid-template-columns: 66px 1fr auto;
    border-radius: 26px;
  }

  .brand {
    width: 56px;
  }

  .brand img {
    height: 37px;
  }

  .menu-button {
    width: 46px;
    height: 46px;
  }

  .project-layout {
    width: calc(100% - 32px);
    padding-top: 108px;
    padding-bottom: 54px;
    grid-template-columns: minmax(138px, .8fr) minmax(0, 1.2fr);
    grid-template-areas:
      "intro intro"
      "profile profile"
      "preview gallery";
    gap: 18px 10px;
  }

  .project-intro h1 {
    font-size: clamp(2.8rem, 14vw, 4rem);
  }

  .project-category {
    font-size: .9rem;
    line-height: 1.45;
  }

  .project-description {
    font-size: .88rem;
    line-height: 1.58;
  }

  .profile-header {
    padding: 18px;
    border-radius: 24px;
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-main {
    width: 100%;
    gap: 12px;
  }

  .profile-main > img,
  .profile-brand {
    width: 56px !important;
    height: 56px !important;
  }

  .profile-name-row h2,
  .profile-main h2 {
    font-size: clamp(1.1rem, 5vw, 1.45rem) !important;
  }

  .profile-subtitle {
    font-size: .78rem;
  }

  .profile-copy {
    margin-top: 8px;
    font-size: .84rem;
    line-height: 1.5;
  }

  .profile-meta {
    gap: 9px 14px;
    font-size: .72rem;
  }

  .preview-column {
    top: 94px;
  }

  .preview-stage,
  .insta-preview-card,
  .photo-preview-card,
  .art-preview-card {
    aspect-ratio: 4 / 5;
    border-radius: 18px;
  }

  .preview-status,
  .photo-counter,
  .art-counter {
    display: grid;
    gap: 3px;
    font-size: .66rem;
  }

  .preview-note {
    font-size: .65rem;
  }

  .portfolio-grid,
  .instagram-grid,
  .photo-grid,
  .project-grid {
    gap: 8px !important;
  }

  .grid-card {
    border-radius: 14px;
  }

  .grid-kind {
    top: 5px;
    right: 5px;
    min-height: 20px;
    padding: 0 6px;
    font-size: .46rem;
  }

  .grid-title {
    left: 5px;
    right: 5px;
    bottom: 5px;
    min-height: 24px;
    padding: 0 7px;
    font-size: .53rem;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .project-layout {
    grid-template-columns: minmax(124px, .76fr) minmax(0, 1.24fr);
    gap-inline: 8px;
  }

  .profile-header {
    padding: 16px;
  }

  .preview-note {
    display: none;
  }
}

@media (max-width: 1024px) {
  /* Las previsualizaciones de Instagram conservan su proporción alta real. */
  .insta-preview-card,
  .preview-stage {
    aspect-ratio: 3 / 5;
  }

  .insta-preview-shell,
  .instagram-shell,
  .preview-panel {
    width: 100%;
    height: 100% !important;
  }

  .insta-shell-image,
  .instagram-shell-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
  }

  /* Convierte las miniaturas de diseños en tarjetas compactas y táctiles. */
  .instagram-grid .grid-card {
    position: relative;
    display: block;
    padding: 6px;
    overflow: hidden;
  }

  .instagram-grid .grid-card img {
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    object-fit: contain;
    border-radius: 11px;
  }

  .instagram-grid .grid-card span {
    position: absolute;
    left: 7px;
    right: 7px;
    bottom: 7px;
    min-height: 27px;
    padding: 0 8px;
    font-size: .58rem;
    line-height: 1.15;
  }

  .photo-grid .grid-card img,
  .portfolio-grid .grid-card img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
  }

  .project-grid .grid-card img {
    width: 100%;
    height: 100% !important;
    object-fit: contain;
  }
}
