/* ===================================================================
   China2SA information pages (FAQ, Terms, Privacy, Fair Usage, Prohibited
   items): phone app layout, 767px and below.

   Each page links this file with media="(max-width: 767px)" after its own
   inline styles, and every rule sits in the same query, so tablet and desktop
   rendering never changes.
   =================================================================== */

@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }

  main {
    padding: 10px max(16px, env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  a {
    -webkit-tap-highlight-color: transparent;
  }

  /* The back link floats at the top as a frosted pill while you read. */
  .back {
    position: sticky;
    top: max(10px, env(safe-area-inset-top));
    z-index: 10;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin: 0 0 14px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(17, 26, 43, 0.84);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 140ms ease;
  }

  .back:active {
    transform: scale(0.96);
  }

  h1 {
    margin-bottom: 6px;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -0.015em;
  }

  h2 {
    font-size: 16px;
    line-height: 1.3;
    letter-spacing: -0.005em;
  }

  h3 {
    font-size: 15px;
  }

  .lead {
    margin-bottom: 18px;
    font-size: 14px;
  }

  /* FAQ: rounded rows with a chevron instead of the browser's triangle. */
  .faq-group {
    margin-top: 18px;
  }

  .faq-item {
    overflow: hidden;
    margin-bottom: 8px;
    border-radius: 14px;
  }

  .faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    padding: 11px 14px;
    font-size: 14.5px;
    line-height: 1.35;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
  }

  .faq-item summary::-webkit-details-marker {
    display: none;
  }

  .faq-item summary::after {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    margin: -4px 4px 0 0;
    border-right: 2px solid rgba(226, 232, 240, 0.55);
    border-bottom: 2px solid rgba(226, 232, 240, 0.55);
    transform: rotate(45deg);
    transition: transform 200ms ease;
  }

  .faq-item[open] summary::after {
    margin-top: 4px;
    transform: rotate(-135deg);
  }

  .faq-item summary:active {
    background: rgba(255, 255, 255, 0.04);
  }

  .faq-answer {
    padding: 0 14px 4px;
    color: #cbd5e1;
    font-size: 14px;
  }

  /* Long documents: comfortable reading rhythm. */
  .terms section {
    margin-top: 20px;
  }

  .terms p,
  .terms li {
    font-size: 14.5px;
    line-height: 1.55;
  }

  .help,
  .card {
    padding: 12px 14px;
    border-radius: 14px;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prohibited items: app-style search and filters. */
  /* Search on its own row; the two filters share one. */
  .sars-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sars-controls .sars-q {
    grid-column: 1 / -1;
  }

  .sars-controls :is(input, select) {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    font-size: 16px;
  }

  .sars-pager button {
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .sars-card,
  .restricted-public-card {
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
  }

  /* Item titles lead with the code and the item's own name; the long category
     path becomes one small line under them. */
  .restricted-public-card h3 {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 2px 6px;
    font-size: 15px;
    line-height: 1.3;
  }

  .restricted-public-card h3 > strong {
    grid-area: 1 / 1;
  }

  .restricted-public-card h3 > .sars-name {
    grid-area: 1 / 2;
  }

  .restricted-public-card h3 > .sars-sep,
  .restricted-public-card .sars-type-more {
    display: none;
  }

  .restricted-public-card h3 > .sars-path {
    grid-area: 2 / 1 / 3 / -1;
    overflow: hidden;
    color: #8492a6;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .restricted-public-card p {
    font-size: 13px;
    line-height: 1.45;
  }

  .restricted-public-card__type,
  .tag {
    font-size: 10.5px;
  }

  .sars-details summary {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }
}
