/* Shared content, with phone layouts and touch-sized controls.
   Loaded after the desktop template so its typography and colors stay intact. */
.mobile-demo-help,
.table-scroll-hint {
  display: none;
}

@media (max-width: 900px) {
  .method-jumps {
    flex-wrap: wrap;
    gap: 4px 16px;
  }

  .method-jumps a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 12px;
  }

  .site-header {
    gap: 4px 12px;
  }

  .header-links {
    gap: 4px 12px;
  }

  .header-links a,
  .theme-toggle,
  .publication-links .button,
  .copy-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-links a {
    padding: 8px 4px;
  }

  .sim-section,
  .page-content,
  footer {
    min-width: 0;
  }

  .mobile-demo-help,
  .table-scroll-hint {
    display: block;
    color: var(--muted);
    font: 14px/1.6 var(--sans);
  }

  .mobile-demo-help {
    padding: 14px 16px;
    background: var(--surface);
    border-radius: 10px;
    margin: 16px 0 24px;
  }

  .sim-panel button,
  .sim-panel select {
    min-height: 44px;
    font-size: 14px;
    padding: 8px;
  }

  .sim-panel select {
    font-size: 16px;
  }

  .sim-panel legend,
  .sim-panel .sim-select-label,
  .sim-status,
  .sim-help,
  .sim-footnote,
  .sim-legend {
    font-size: 12px;
    line-height: 1.5;
  }

  .sim-tabs button {
    padding: 8px 2px;
  }

  .sim-tab-content {
    min-height: 0;
  }

  .table-scroll {
    max-width: 100%;
    isolation: isolate;
  }

  .data-table tbody th:first-child,
  .data-table thead tr:first-child th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--paper);
    box-shadow: 1px 0 var(--line);
    min-width: 110px;
    max-width: 140px;
    white-space: normal;
  }

  .data-table tbody .is-ours th:first-child {
    background: color-mix(in srgb, var(--flame) 7%, var(--paper));
  }

  .bibtex pre {
    padding-top: 64px;
  }
}

@media (max-width: 600px) {
  .cover-title {
    position: absolute;
    padding: 0 16px 16px;
    color: white;
    background: linear-gradient(to top, rgba(8, 10, 14, .88) 0%, rgba(8, 10, 14, .5) 35%, transparent 75%);
  }

  .cover h1 {
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
  }

  .cover-title .venue {
    margin-top: 8px;
    font-size: 12px;
    letter-spacing: .06em;
  }

  .cover-copy {
    margin: 0;
    padding: 12px 20px 0;
  }

  .authors {
    font-size: 14px;
  }

  .publication-links {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 340px;
    margin: 16px auto 0;
    gap: 6px;
  }

  .publication-links .button {
    grid-column: span 2;
    padding: 8px;
    font-size: 13px;
  }

  .publication-links .button:nth-child(4) {
    grid-column: 2 / span 2;
  }

  .publication-links .button:disabled::after {
    /* Coming-soon status remains in each button's accessible name and title. */
    content: none;
  }

  .site-header {
    padding: 12px 16px 0;
  }

  .sim-section,
  .page-section,
  .page-section:first-child {
    margin-top: 28px;
    padding-top: 28px;
    padding-bottom: 0;
  }

  h2,
  .sim-section h2,
  .resources-section h2,
  .method-block-heading h3,
  .video-card--method figcaption h3,
  .subsection-heading h3,
  .benchmark-row > h3,
  .table-block > h3,
  .method-optimization > h4,
  .video-card--feature figcaption h3 {
    line-height: 1.25;
    margin-bottom: 12px;
  }

  .section-heading,
  .methods-section .section-heading,
  .benchmark-section .section-heading {
    margin-bottom: 20px;
  }

  .sim-intro {
    margin-bottom: 16px;
  }

  .mobile-demo-help {
    margin: 12px 0 20px;
    padding: 12px 14px;
  }

  .metric-grid {
    margin-top: 20px;
    gap: 12px;
  }

  .metric-card,
  .metric-card:first-child,
  .metric-card + .metric-card {
    padding: 18px;
  }

  .method-block + .method-block,
  .training-video-pair + .method-block {
    margin-top: 32px;
    padding-top: 16px;
  }

  .training-video-pair > .method-block + .method-block {
    margin-top: 0;
    padding-top: 0;
  }

  .benchmark-stack {
    gap: 32px;
  }

  .benchmark-row + .benchmark-row {
    margin-top: 0;
    padding-top: 24px;
  }

  .real-world-intro {
    margin-top: 32px;
  }

  footer {
    margin-top: 40px;
    padding: 24px 0 32px;
  }

  .method-video-pair,
  .benchmark-videos,
  .video-grid--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-grid--three .video-card {
    display: block;
  }

  .sim-controls .sim-grasp-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sim-policy-picker {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .cover-title h1 {
    font-size: clamp(18px, 5vw, 28px);
  }
}

@media (hover: none) and (pointer: coarse) {
  .sim-keyboard-help {
    display: none;
  }

  .mobile-demo-help {
    display: block;
  }
}
