/* Phone and tablet layout. The design pages use inline styles, so these rules use !important.
   Nothing here applies on a computer screen (wider than 900px). */
html { -webkit-text-size-adjust: 100%; }
.tl-root { overflow-x: clip; }
img { max-width: 100%; }
.nav-toggle { display: none; }
.topbar { display: none; }
.car-nav { display: none; }

/* ---- tablets and below ---- */
@media (max-width: 900px) {
  /* hero: photo beside the text (phones and tablets) */
  #top { min-height: 0 !important; display: block; }
  #top > img.photo-in {
    position: absolute !important; top: 0 !important; right: 0 !important; left: auto !important;
    width: 50% !important; height: clamp(306px, 60vw, 470px) !important; object-position: 66% 40% !important;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 42%), linear-gradient(to bottom, #000 62%, transparent 100%) !important;
    -webkit-mask-composite: source-in !important;
    mask-image: linear-gradient(to right, transparent 0%, #000 42%), linear-gradient(to bottom, #000 62%, transparent 100%) !important;
    mask-composite: intersect !important;
  }
  #top > div { padding: clamp(34px, 6vw, 64px) clamp(20px, 3.5vw, 32px) 56px !important; }
  #top > div > div { gap: 18px !important; max-width: none !important; }
  #top > div > div > p.rise:first-child { font-size: 10.5px !important; letter-spacing: 0.14em !important; line-height: 1.5; white-space: nowrap; }
  #top h1 { font-size: clamp(36px, 7vw, 56px) !important; line-height: 1.06 !important; max-width: 62%; }
  #top p.d2 { font-size: clamp(15px, 2.2vw, 17px) !important; line-height: 1.65 !important; margin-top: clamp(30px, 6vw, 48px) !important; max-width: 520px; }
  #top div[style*="gap: 28px"] { gap: 12px 20px !important; font-size: 12.5px !important; }

  section:not(#top) { padding-left: 24px !important; padding-right: 24px !important; padding-top: 80px !important; padding-bottom: 80px !important; }
  #about { gap: 56px !important; }
  #contact > div { grid-template-columns: 1fr !important; gap: 48px !important; }
  .io .rv.rv-left:not(.in), .io .rv.rv-right:not(.in) { transform: translateY(40px) !important; }
}

/* ---- phones ---- */
@media (max-width: 640px) {

  /* header: one line, logo + menu button */
  header nav { padding: 10px 20px !important; gap: 0 !important; flex-wrap: wrap !important; align-items: center !important; }
  header nav > a img { height: 54px !important; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: #0B1C35; padding: 4px 20px; min-height: 38px; }
  .nq-tel { display: flex; align-items: center; gap: 8px; color: #FFFFFF !important; font-size: 13px; font-weight: 600; letter-spacing: .02em; text-decoration: none; white-space: nowrap; padding: 6px 0; }
  .nq-tel svg { stroke: #C9A46A; }
  .nq-lang { font-size: 13px; white-space: nowrap; color: rgba(255,255,255,.65) !important; }
  .nq-lang strong { color: #C9A46A !important; }
  .nq-lang a { color: #FFFFFF !important; padding: 8px 4px; text-decoration: none; }
  .nav-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 46px; height: 46px; margin-left: auto; padding: 0 12px; box-sizing: border-box;
    background: #FFFFFF; border: 1px solid #DCCDB6; border-radius: 12px; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: #0B1C35; border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
  header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  header nav > #nav-menu { display: none !important; }
  header.nav-open nav > #nav-menu {
    display: flex !important; flex-direction: column !important; align-items: stretch !important;
    width: 100%; gap: 0 !important; padding: 8px 0 6px; margin-top: 8px; border-top: 1px solid #E8DDCE;
  }
  header.nav-open #nav-menu > div[style*="gap: 28px"] {
    order: 1; display: flex !important; flex-direction: column !important; align-items: stretch !important;
    gap: 0 !important; font-size: 16px !important;
  }
  header.nav-open #nav-menu > div[style*="gap: 28px"] > a { display: block; padding: 13px 2px !important; border-bottom: 1px solid #F0E9DD !important; }
  #nav-menu > div[style*="gap: 28px"] > span { display: none !important; }
  #nav-menu > div[style*="padding-bottom: 12px"] a[href^="tel:"] { display: none !important; }
  header.nav-open #nav-menu > div[style*="padding-bottom: 12px"] {
    order: 2; display: flex !important; flex-direction: column !important; align-items: flex-start !important;
    gap: 4px !important; padding: 10px 2px 4px !important; border-bottom: 0 !important; font-size: 14px !important;
  }
  header.nav-open #nav-menu > div[style*="padding-bottom: 12px"] a { padding: 8px 0; }

  section:not(#top) { padding-left: 20px !important; padding-right: 20px !important; padding-top: 60px !important; padding-bottom: 60px !important; }
  h1 { font-size: 40px !important; line-height: 1.08 !important; }
  h2 { font-size: 34px !important; line-height: 1.15 !important; }
  #contact h2 { font-size: 38px !important; }

  div[style*="auto-fit"] { grid-template-columns: 1fr !important; }
  .card[style*="padding: 40px 34px"] { padding: 32px 24px !important; }
  .card[style*="padding: 30px 26px"] { padding: 26px 22px !important; }

  /* plans and one-time services: one card at a time, swipe or use the dots/arrows */
  #services div[style*="auto-fit"],
  section[style*="padding: 96px"] div[style*="auto-fit"] {
    display: flex !important; gap: 16px !important; margin: 0 -14px !important; padding: 26px 14px 18px !important;
    overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 14px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; align-items: stretch !important;
  }
  #services div[style*="auto-fit"]::-webkit-scrollbar,
  section[style*="padding: 96px"] div[style*="auto-fit"]::-webkit-scrollbar { display: none; }
  #services div[style*="auto-fit"] > .card,
  section[style*="padding: 96px"] div[style*="auto-fit"] > .card {
    flex: 0 0 100% !important; box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always;
    opacity: 1 !important; transform: none !important; transition-delay: 0s !important;
  }
  .car-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
  .car-dots { display: flex; align-items: center; gap: 10px; }
  .car-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: rgba(11,28,53,.25); cursor: pointer; transition: background-color .2s ease, transform .2s ease; }
  .car-dot.on { background: #0B1C35; transform: scale(1.25); }
  .car-arrow { width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid #0B1C35; background: transparent; color: #0B1C35; font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: opacity .2s ease; }
  .car-arrow[disabled] { opacity: .3; cursor: default; }
  .car-dark .car-dot { background: rgba(255,255,255,.3); }
  .car-dark .car-dot.on { background: #C9A46A; }
  .car-dark .car-arrow { border-color: #C9A46A; color: #C9A46A; }

  /* about: two-line title beside the photo, text below */
  #about {
    display: grid !important; grid-template-columns: minmax(0, 1fr) 104px !important;
    column-gap: 16px !important; row-gap: 22px !important; align-items: center !important;
  }
  #about > div:first-child { display: contents !important; }
  #about > div:first-child > p:first-child { grid-column: 1 / -1; grid-row: 1; }
  #about > div:first-child > h2 {
    grid-column: 1; grid-row: 2; white-space: nowrap; line-height: 1.3 !important;
    font-size: clamp(15px, calc((100vw - 160px) / 10.8), 26px) !important;
  }
  html[lang="es"] #about > div:first-child > h2 { font-size: clamp(15px, calc((100vw - 160px) / 12.2), 24px) !important; }
  #about > div:first-child > p:nth-child(3),
  #about > div:first-child > p:nth-child(4) { grid-column: 1 / -1; }
  #about > div:last-child { grid-column: 2; grid-row: 2; width: 100% !important; margin: 0 0 12px 10px; box-sizing: border-box; justify-self: stretch !important; }
  #about > div:last-child > div:first-child { inset: 10px 10px -10px -10px !important; border-radius: 14px !important; }
  #about > div:last-child > img { border-radius: 14px !important; }

  /* contact form */
  #contact-form { padding: 24px 20px !important; grid-template-columns: 1fr !important; }
  input, select, textarea { font-size: 16px !important; }

  /* FAQ */
  details summary { font-size: 16px !important; }
  details p { margin-left: 0 !important; }
  details summary > span > span:first-child { min-width: 26px !important; }

  footer { padding: 40px 20px !important; }
}

@media (max-width: 380px) {
  #top h1 { font-size: 32px !important; }
  h2 { font-size: 30px !important; }
  #about { grid-template-columns: minmax(0, 1fr) 92px !important; }
  #about > div:first-child > h2 { font-size: clamp(14px, calc((100vw - 148px) / 10.8), 26px) !important; }
  html[lang="es"] #about > div:first-child > h2 { font-size: clamp(14px, calc((100vw - 148px) / 12.2), 24px) !important; }
}
