/* Phone and small-tablet polish for the editorial landing page. */
@media (max-width: 720px) {
  html,
  body,
  #dc-root {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }

  header[data-screen-label="Header"] {
    height: auto !important;
  }

  header[data-screen-label="Header"] > div {
    min-height: 64px;
    height: auto !important;
    padding: 8px 16px !important;
    gap: 8px !important;
  }

  header[data-screen-label="Header"] > div > a:first-child {
    min-width: 0;
    min-height: 44px;
    flex: 0 1 auto;
    gap: 8px !important;
    font-size: 16px !important;
  }

  header[data-screen-label="Header"] > div > a:first-child > span {
    width: 28px !important;
    height: 28px !important;
  }

  header[data-screen-label="Header"] nav {
    min-width: 0;
    gap: 6px !important;
  }

  header[data-screen-label="Header"] nav button {
    display: none !important;
  }

  header[data-screen-label="Header"] nav a[href="/login"] {
    min-height: 42px !important;
    padding: 0 4px !important;
    font-size: 12.5px !important;
  }

  header[data-screen-label="Header"] nav a[href="/signup"] {
    min-height: 42px !important;
    padding: 0 13px !important;
    font-size: 14px !important;
  }

  section > div {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  section h1,
  section h2,
  section h3,
  section p {
    max-width: 100% !important;
  }

  #top > div {
    padding-top: 34px !important;
    padding-bottom: 44px !important;
  }

  #top h1 {
    margin-top: 16px !important;
    font-size: clamp(32px, 9vw, 42px) !important;
    line-height: 1.32 !important;
  }

  #top h1 span {
    white-space: normal !important;
  }

  #top p {
    width: auto !important;
    font-size: 16px !important;
  }

  #top [style*="margin-top:26px"][style*="flex-wrap:wrap"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  #top a[href="/signup"],
  #top a[href="#pricing"] {
    width: 100% !important;
    min-height: 50px !important;
    justify-content: center !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  section h2 {
    font-size: clamp(28px, 8vw, 36px) !important;
    line-height: 1.38 !important;
  }

  section [style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  section p[style*="width:"] {
    width: auto !important;
  }

  section button,
  section select,
  section input {
    min-height: 44px;
  }

  /* The desktop POS canvas is presented as a complete, non-scrolling preview on phones. */
  #demo > div > div:nth-child(3) {
    position: relative;
    height: 255px;
    overflow: hidden !important;
    background: #f8fafc !important;
  }

  #demo > div > div:nth-child(3) > div {
    transform: scale(.52);
    transform-origin: top left;
  }

  #demo > div > div:nth-child(3)::after {
    content: "หน้าจอจริง · ย่อให้พอดีมือถือ";
    position: absolute;
    right: 8px;
    bottom: 7px;
    z-index: 2;
    padding: 4px 8px;
    border: 1px solid #dbe3ea;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #556067;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
  }

  #features {
    overflow: hidden;
  }

  #reprice [style*="overflow-x:auto"] {
    scrollbar-width: thin;
  }

  #reprice [style*="overflow-x:auto"]::before {
    content: "เลื่อนตารางซ้าย–ขวา →";
    position: sticky;
    left: 0;
    z-index: 2;
    display: block;
    width: max-content;
    padding: 7px 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11.5px;
    font-weight: 700;
  }

  #compare > div,
  #cmp-body > div > div:first-child,
  #compare .cmp-row {
    grid-template-columns: minmax(0, 1fr) 48px 48px !important;
    gap: 4px !important;
    padding-right: 0 !important;
  }

  #compare .cmp-row {
    font-size: 14px !important;
  }

  #compare .cmp-row > span:first-child,
  #cmp-body > div > div:first-child > span:first-child {
    padding-left: 10px !important;
  }

  #compare small {
    margin-top: 2px;
    font-size: 11.5px;
    line-height: 1.5;
  }

  #plans > div {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  footer > div,
  footer > div:last-child {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (min-width: 415px) and (max-width: 480px) {
  #demo > div > div:nth-child(3) {
    height: 172px;
  }

  #demo > div > div:nth-child(3) > div {
    transform: scale(.35);
  }
}

@media (min-width: 375px) and (max-width: 414px) {
  #demo > div > div:nth-child(3) {
    height: 152px;
  }

  #demo > div > div:nth-child(3) > div {
    transform: scale(.31);
  }
}

@media (max-width: 374px) {
  header[data-screen-label="Header"] > div {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  header[data-screen-label="Header"] > div > a:first-child {
    font-size: 15px !important;
  }

  header[data-screen-label="Header"] nav a[href="/signup"] {
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 13px !important;
  }

  #demo > div > div:nth-child(3) {
    height: 130px;
  }

  #demo > div > div:nth-child(3) > div {
    transform: scale(.265);
  }
}

@media (max-width: 335px) {
  header[data-screen-label="Header"] nav a[href="/login"] {
    display: none !important;
  }
}
