/* EMRY responsive safeguards
   Mobile first. This file only adds layout protection and does not change the visual direction. */

img {
  max-width: 100%;
}

main,
section,
.site-header,
.site-footer {
  min-width: 0;
}

@media (max-width: 719px) {
  .swipe-hint {
    display: none;
  }

  .site-header {
    width: calc(100% - 28px);
    padding-top: calc(16px + env(safe-area-inset-top));
  }

  .brand {
    font-size: clamp(25px, 7vw, 30px);
  }

  .header-cta {
    flex: 0 0 auto;
    font-size: 12px;
    padding: 9px 13px;
  }

  .hero {
    width: calc(100% - 28px);
    min-height: 0;
    padding-top: 30px;
    padding-bottom: 44px;
  }

  .hero-copy {
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
  }

  h1 {
    max-width: 9.8ch;
    font-size: clamp(48px, 14.6vw, 66px);
    line-height: .92;
  }

  .hero-text {
    max-width: 25ch;
    margin-top: 20px;
    font-size: clamp(14px, 4.1vw, 16px);
  }

  .app-store-button {
    margin-top: 24px;
    transform: scale(.96);
    transform-origin: center;
  }

  .hero-visual {
    width: min(100%, 520px);
    height: clamp(455px, 126vw, 630px);
    margin: 18px auto 0;
  }

  .phone-shell {
    width: clamp(210px, 56vw, 268px);
    left: 31%;
  }

  .sunflower-card,
  .autumn-card {
    width: clamp(112px, 30vw, 140px);
    height: clamp(199px, 53.33vw, 249px);
  }

  .sunflower-card {
    right: 4%;
    top: 4%;
  }

  .autumn-card {
    right: 3%;
    top: 45%;
  }

  .hero-signature {
    max-width: 100%;
    margin-top: 24px;
    gap: 7px;
    font-size: clamp(36px, 10.8vw, 46px);
  }

  .signature-heart {
    font-size: clamp(25px, 7.5vw, 32px);
  }

  .presets-section,
  .templates-section {
    padding-top: 60px;
    padding-bottom: 66px;
  }

  .presets-inner,
  .templates-inner {
    width: 100%;
    padding-inline: 18px;
  }

  .presets-copy,
  .templates-copy {
    width: 100%;
    max-width: 390px;
  }

  .presets-copy h2,
  .templates-copy h2 {
    font-size: clamp(40px, 10.8vw, 54px);
    line-height: .97;
  }

  .presets-description,
  .templates-description {
    max-width: 28ch;
    font-size: 14px;
  }

  .preset-carousel,
  .template-carousel {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: calc(100% + 18px);
    max-width: none;
    margin-right: -18px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: auto !important;
  }

  .preset-card,
  .template-card {
    display: block;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    scroll-snap-align: start;
  }

  .preset-card {
    flex-basis: min(76vw, 320px) !important;
    width: min(76vw, 320px) !important;
    max-width: 320px;
  }

  .template-card {
    flex-basis: min(72vw, 305px) !important;
    width: min(72vw, 305px) !important;
    max-width: 305px;
  }

  .preset-card img,
  .template-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }

  .preset-card img {
    aspect-ratio: 2 / 3;
  }

  .template-card img {
    aspect-ratio: 4 / 5;
  }

  .preset-card-label,
  .template-card-label {
    font-size: 22px;
  }

  .site-footer {
    padding-inline: 18px;
  }

  .footer-links {
    gap: 12px 18px;
  }
}

@media (max-width: 380px) {
  .site-header,
  .hero {
    width: calc(100% - 24px);
  }

  h1 {
    font-size: clamp(44px, 14vw, 54px);
  }

  .hero-visual {
    height: clamp(425px, 127vw, 505px);
  }

  .phone-shell {
    width: clamp(198px, 56vw, 230px);
    left: 30%;
  }

  .sunflower-card,
  .autumn-card {
    width: clamp(104px, 29vw, 122px);
    height: clamp(185px, 51.6vw, 217px);
  }

  .hero-signature {
    font-size: clamp(33px, 10.4vw, 39px);
  }

  .preset-card {
    flex-basis: 78vw !important;
    width: 78vw !important;
  }

  .template-card {
    flex-basis: 74vw !important;
    width: 74vw !important;
  }
}

@media (min-width: 720px) and (max-width: 979px) {
  .hero {
    width: min(100% - 48px, 920px);
    gap: 28px;
  }

  .hero-visual {
    min-width: 0;
  }

  .presets-inner,
  .templates-inner {
    width: min(100% - 48px, 920px);
    padding-inline: 0;
  }

  .preset-carousel,
  .template-carousel {
    min-width: 0;
  }
}

@media (min-width: 980px) {
  .presets-inner,
  .templates-inner,
  .hero,
  .site-header {
    max-width: 1440px;
  }

  .preset-card,
  .template-card {
    min-width: 0;
  }
}
