/* Phone layouts use natural text flow; desktop compositions remain in their
   page styles. Keep this last so legacy breakpoint rules cannot tighten them. */
body[data-site-page="research"] h1 { line-height: 1.3; }
body[data-site-page="finditem"] .hero h1 { line-height: 1.4; }
body[data-site-page="finditem"] .section-title { line-height: 1.35; }
body[data-site-page="finditem"] .wave-split .ws-word { line-height: 1.35; }
body[data-site-page="home"] .fact-ironpulse .ironpulse-icon { transform: none; right: 24px; }

@media (max-width: 820px), (any-pointer: coarse) and (max-width: 1400px) {
  body[data-site-page] {
    --mobile-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body[data-site-page] :is(main,section,article,header,nav,div,dl,dt,dd) { min-width: 0; }
  body[data-site-page] :is(h1,h2,h3,h4,p,dt,dd,a,button) { overflow-wrap: break-word; }

  /* Harry Xin: one page margin, rather than a frame inside another frame. */
  html.app-mode body[data-site-page="home"] .wrap {
    width: 100%;
    padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
  }
  html.app-mode body[data-site-page="home"] :is(.hero,section,#about,#creating) {
    margin-top: 18px;
    padding: 24px 0 36px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  html.app-mode body[data-site-page="home"] .hero {
    padding-top: 46px;
    min-height: min(640px, calc(100svh - 180px));
  }
  body[data-site-page="home"] .hero h1 {
    font-size: clamp(44px, 13vw, 62px);
    line-height: 1.12;
    letter-spacing: -.035em;
  }
  body[data-site-page="home"] :is(.lede,.about-copy,.show-feature p,.card .pd,.rlcard-project-summary) {
    font-family: var(--mobile-sans);
    font-size: 16px;
    line-height: 1.75;
    letter-spacing: 0;
  }
  body[data-site-page="home"] .lede { font-size: 18px; margin: 26px 0 30px; }
  body[data-site-page="home"] .lede b { font-family: inherit; }
  body[data-site-page="home"] .shead { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: baseline; margin-bottom: 28px; }
  body[data-site-page="home"] .shead h2 { min-width: 0; font-size: clamp(30px, 8.7vw, 38px); line-height: 1.25; letter-spacing: -.02em; }
  body[data-site-page="home"] .shead .num { display: none; }
  body[data-site-page="home"] .shead .arr-link { margin-left: 0; font-size: 11px; letter-spacing: .025em; }
  body[data-site-page="home"] .about-intro { font: 600 20px/1.6 var(--mobile-sans); margin-bottom: 28px; }
  body[data-site-page="home"] .about-area { padding: 24px 20px; }
  body[data-site-page="home"] .about-area h3 { padding-right: 30px; font: 700 26px/1.3 var(--mobile-sans); margin-bottom: 16px; }
  body[data-site-page="home"] .about-arrow { top: 26px; right: 20px; }
  body[data-site-page="home"] .about-repo-row { gap: 12px; grid-template-columns: minmax(74px,.32fr) minmax(0,1fr); }
  body[data-site-page="home"] .about-robotics-id { gap: 5px; }
  body[data-site-page="home"] .about-robotics-number { line-height: 1.08; margin: 0; font-size: clamp(60px,17vw,78px); }
  body[data-site-page="home"] :is(.about-robotics-eyebrow,.about-robotics-location) { line-height: 1.5; font-size: 9px; letter-spacing: .06em; }
  body[data-site-page="home"] .facts .fact { min-height: 180px; padding: 24px; }
  body[data-site-page="home"] .facts .fact-link { display: grid; grid-template-columns: minmax(0,1fr) 88px; grid-template-rows: auto 1fr auto; gap: 12px 18px; padding: 24px; }
  body[data-site-page="home"] .fact-link .k { grid-column: 1 / -1; }
  body[data-site-page="home"] .fact-link .v { display: block; grid-column: 1; align-self: center; }
  body[data-site-page="home"] .fact-link .fact-official { grid-column: 1; margin-top: 0; line-height: 1.5; }
  body[data-site-page="home"] .facts .fact .v { font: 650 24px/1.3 var(--mobile-sans); max-width: 100%; white-space: normal; letter-spacing: -.025em; }
  body[data-site-page="home"] .fact .v [data-lang] { font: inherit; letter-spacing: inherit; }
  body[data-site-page="home"] .fact .fact-icon { position: static; grid-column: 2; grid-row: 2 / 4; align-self: center; justify-self: center; width: 78px; height: 78px; transform: none; }
  body[data-site-page="home"] .fact-ironpulse .ironpulse-icon { width: 88px; height: 88px; }
  body[data-site-page="home"] .show-copy { padding: 24px 20px; }
  body[data-site-page="home"] .show-feature :is(h3,h4) { font: 700 26px/1.3 var(--mobile-sans); letter-spacing: -.015em; margin-bottom: 16px; }
  body[data-site-page="home"] .card { min-height: 0; padding: 24px 20px; }
  body[data-site-page="home"] .card .pt { font-size: 34px; line-height: 1.14; }
  body[data-site-page="home"] .card.card-rlcard { padding: 0; }
  body[data-site-page="home"] .card-rlcard .rlcard-project-copy { min-height: 0; padding: 26px 20px; }
  body[data-site-page="home"] .card-rlcard .pt { font-size: clamp(34px,10vw,42px); line-height: 1.1; }
  body[data-site-page="home"] .research-archive-note { font-family: var(--mobile-sans); line-height: 1.7; }
  body[data-site-page="home"] .mobile-tabbar { min-height: 66px; padding: 5px; }
  body[data-site-page="home"] .mobile-tabbar a { min-height: 54px; gap: 5px; }
  body[data-site-page="home"] .mobile-tabbar a>span { font-family: var(--mobile-sans); font-size: 10px; line-height: 1.2; letter-spacing: 0; }
  body[data-site-page="home"] .mobile-tabbar a::after { bottom: 2px; }

  /* Product pages keep their own identity, with readable multiline headings. */
  body[data-site-page="finditem"] .hero h1 { font-size: clamp(38px,10.5vw,58px); line-height: 1.4; letter-spacing: -.025em; }
  body[data-site-page="finditem"] .section-title { font-size: clamp(28px,7.5vw,40px); line-height: 1.3; margin-bottom: 32px; }
  body[data-site-page="finditem"] .wave-split :is(.ws-word,.ws-inner) { display: inline; overflow: visible; vertical-align: baseline; line-height: inherit; transform: none; transition: none; }
  body[data-site-page="finditem"] :is(.step p,.feature p,.tl-desc) { font-size: 15px; line-height: 1.7; }
  body[data-site-page="finditem"] :is(.hero-sub,.architecture-lead p) { font-size: 17px; line-height: 1.7; }
  body[data-site-page="finditem"] .hero-label { max-width: 100%; font-size: 11px; line-height: 1.7; letter-spacing: .06em; }
  body[data-site-page="finditem"] .hero { padding: 100px 22px 60px; height: auto; min-height: 100svh; }
  body[data-site-page="finditem"] :is(.how,.features,.demo,.roadmap,.architecture) { padding: 64px 22px; }
  body[data-site-page="finditem"] .tl-title { line-height: 1.35; }
  body[data-site-page="finditem"] .nav-brand { white-space: nowrap; }
  body[data-site-page="finditem"] .nav-brand .cn-name { font-size: 13px; margin-left: 5px; letter-spacing: 0; }
  body[data-site-page="finditem"] :is(.nav-links,.parent-site-link) { display: none; }
  body[data-site-page="finditem"] .nav-toggle { display: flex; }
  body[data-site-page="finditem"] .mobile-menu { display: flex; overflow-y: auto; }

  body[data-site-page="research"] h1 { font-size: clamp(30px,8.5vw,42px); line-height: 1.3; letter-spacing: -.025em; }
  body[data-site-page="research"] .hero { padding: 42px 0 44px; }
  body[data-site-page="research"] .section-heading h2 { font-size: clamp(27px,7.5vw,36px); line-height: 1.35; letter-spacing: -.02em; }
  body[data-site-page="research"] .section { padding: 48px 0; }
  body[data-site-page="research"] .matrix-cell strong { line-height: 1.45; font-size: 18px; }
  body[data-site-page="research"] .matrix-cell code { font-size: 12px; line-height: 1.6; letter-spacing: 0; }
  body[data-site-page="research"] .mechanism-matrix>* { padding: 16px 12px; }
  body[data-site-page="research"] .table-wrap { overscroll-behavior-inline: contain; scrollbar-width: thin; }
  body[data-site-page="research"] :is(.section-heading,.mechanism-csv-head) { gap: 16px; }
  body[data-site-page="rlcard"] :is(.hero h1,.research-note h2) { line-height: 1.22; letter-spacing: -.02em; font-size: clamp(32px,9vw,48px); }

  body[data-site-page="driverlab"] .project-hero h1 { line-height: 1.15; }
  body[data-site-page="driverlab"] .hero-statement { font-size: clamp(27px,7.5vw,38px); line-height: 1.35; }
  body[data-site-page="driverlab"] :is(.section-heading h2,.project-note h2,.film-heading h2) { line-height: 1.3; }
  body[data-site-page="driverlab"] :is(.header-tools,.language-switch) { flex-shrink: 0; }
  body[data-site-page="driverlab"] .language-switch button { min-width: 36px; min-height: 44px; }
  body[data-site-page="driverlab"] .theme-toggle { width: 44px; height: 44px; }
  body[data-site-page="driverlab"] .film-heading { flex-wrap: wrap; align-items: baseline; }
  body[data-site-page="driverlab"] .film-chapters button { min-width: 0; line-height: 1.6; }
  body[data-site-page="driverlab"] .film-chapters time { flex-shrink: 0; }
  body[data-site-page="driverlab"] .project-bottom { flex-wrap: wrap; }
}

@media (max-height: 600px) and (any-pointer: coarse) {
  body[data-site-page="finditem"] .mobile-menu { justify-content: flex-start; padding-top: 76px; }
}

@media (max-width: 360px) {
  html.app-mode body[data-site-page="home"] .wrap { padding-inline: 16px; }
  body[data-site-page="home"] .facts .fact-link { grid-template-columns: minmax(0,1fr) 72px; gap: 12px; padding: 22px 18px; }
  body[data-site-page="home"] .facts .fact .v { font-size: 21px; }
  body[data-site-page="home"] .fact .fact-icon { width: 68px; height: 68px; }
  body[data-site-page="home"] .about-robotics-lockup { grid-template-columns: 88px 1px minmax(0,1fr); }
  body[data-site-page="home"] .about-robotics-number { font-size: 54px; }
  body[data-site-page="home"] .about-robotics-location { font-size: 8px; }
  body[data-site-page="driverlab"] .header-inner { gap: 6px; }
  body[data-site-page="driverlab"] .site-brand { gap: 5px; font-size: 15px; }
  body[data-site-page="driverlab"] .site-brand img { width: 26px; height: 26px; }
  body[data-site-page="driverlab"] .hero-actions { flex-direction: column; align-items: stretch; }
  body[data-site-page="driverlab"] .hero-actions .button { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-site-page="finditem"] .hero :is(h1,.hero-label,.hero-sub,.hero-actions) { animation: none; opacity: 1; transform: none; }
}
