/**
 * Apple Vision Pro–aligned mobile adaptation for People / Places / Cities.
 * Reference breakpoints from apple.com product pages: 1068 (tablet), 734 (phone), 480 (small).
 * Goals: bottom-anchored hero composition, 44px CTAs, no HUD collisions, no horizontal overflow.
 */

/* —— Tablet —— */
@media only screen and (max-width: 1068px) {
  body.page-people,
  body.page-places,
  body.page-cities {
    --gutter: max(1.25rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  }

  body.page-people .hero__lockup,
  body.page-places .hero__lockup,
  body.page-cities #homeIntro .hero__lockup {
    font-size: clamp(2rem, 5.5vw, 3.25rem);
  }

  body.page-people .hero__lede-heading,
  body.page-places .hero__lede-heading,
  body.page-cities #homeIntro .hero__lede-heading {
    font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  }
}

/* —— Phone (Apple 734) —— */
@media only screen and (max-width: 734px) {
  html:has(body.page-people),
  html:has(body.page-places),
  html:has(body.page-cities) {
    overflow-x: clip;
    overflow-y: auto;
  }

  body.page-people,
  body.page-places,
  body.page-cities {
    overflow-x: clip;
    overflow-y: visible;
  }

  body.page-people,
  body.page-places,
  body.page-cities {
    --gutter: max(1rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  }

  /* Compact top chrome: phone drops “Gurudada” wordmark, keeps “g” + page title */
  body.page-people .hud .brand,
  body.page-places .hud .brand,
  body.page-cities .hud .brand {
    font-size: 0.84rem;
    gap: 0.35rem;
    min-width: 0;
    flex: 0 1 auto;
  }

  body.page-people .hud .brand__mark,
  body.page-places .hud .brand__mark,
  body.page-cities .hud .brand__mark {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* Hide only the Gurudada word next to the mark; keep / People|Places|Cities */
  body.page-people .hud .brand > .brand__name,
  body.page-places .hud .brand > .brand__name,
  body.page-cities .hud .brand > .brand__name {
    display: none !important;
  }

  body.page-cities .hud .cities-search {
    flex: 0 1 auto;
    max-width: min(11.5rem, 42vw);
    margin-left: 0.35rem;
  }

  body.page-cities .hud .cities-search:not(.is-open) input {
    flex: 0 1 0;
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    padding: 0 !important;
  }

  body.page-cities .hud .cities-search.is-open {
    flex: 1 1 auto;
    max-width: none;
  }

  body.page-cities .hud .cities-search.is-open input {
    opacity: 1;
    pointer-events: auto;
    flex: 1 1 auto;
  }

  /* Hero: Vision Pro bottom composition + safe-area clearance for dots */
  body.page-people .hero__sticky,
  body.page-people .hero.sample-reel .hero__inner,
  body.page-places .hero.sample-reel .hero__inner,
  body.page-cities #homeIntro .hero__inner {
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    padding-bottom: calc(
      max(3.75rem, env(safe-area-inset-bottom, 0px) + 3.1rem)
    );
  }

  body.page-people .hero__lockup,
  body.page-places .hero__lockup,
  body.page-cities #homeIntro .hero__lockup {
    font-size: clamp(1.7rem, 8.2vw, 2.125rem);
    letter-spacing: -0.02em;
    max-width: 100%;
  }

  body.page-people .hero__foot,
  body.page-places .hero__foot,
  body.page-cities #homeIntro .hero__foot {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: clamp(1rem, 3vh, 1.5rem);
    width: 100%;
  }

  body.page-people .hero__lede,
  body.page-places .hero__lede,
  body.page-cities #homeIntro .hero__lede,
  body.page-cities #homeIntro .hero__copy {
    width: 100%;
    max-width: 100%;
    flex: 0 1 auto;
  }

  /* People slogans: allow wrap (desktop uses nowrap max-content) */
  body.page-people .hero__lede {
    width: 100%;
    max-width: 100%;
    font-size: clamp(1.05rem, 4.6vw, 1.28rem);
    line-height: 1.28;
  }

  body.page-people .hero__lede span {
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  body.page-people .hero__lede-heading,
  body.page-places .hero__lede-heading,
  body.page-cities #homeIntro .hero__lede-heading {
    font-size: clamp(1.15rem, 5.2vw, 1.4rem);
    line-height: 1.2;
    margin-bottom: 0.55rem;
  }

  /* Long place/city bodies: Apple-like denser secondary type */
  body.page-places .hero__lede {
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  body.page-places .hero__lede-body,
  body.page-cities #homeIntro .hero__lede-body {
    font-size: 0.8125rem;
    line-height: 1.45;
    font-weight: 500;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    max-width: 100%;
  }

  body.page-cities #homeIntro .hero__copy {
    gap: 0.85rem;
  }

  body.page-cities #homeIntro .hero__ambassador {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    margin-top: 0;
    padding: 0.65rem 1.1rem;
    font-size: 0.875rem;
    box-sizing: border-box;
  }

  body.page-people .hero__actions,
  body.page-places .hero__actions,
  body.page-cities #homeIntro .hero__actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  body.page-people .hero__actions .cta,
  body.page-places .hero__actions .cta,
  body.page-cities #homeIntro .hero__actions .cta {
    flex: 1 1 calc(50% - 0.35rem);
    justify-content: center;
    min-height: 44px;
    padding: 0.65rem 0.95rem;
    font-size: 0.875rem;
    white-space: nowrap;
    box-sizing: border-box;
  }

  /* Keep download travel animation from breaking flex basis */
  body.page-people a.cta.hero__download,
  body.page-places a.cta.hero__download,
  body.page-cities #homeIntro a.cta.hero__download {
    max-width: none;
  }

  body[data-download="hud"].page-people a.cta.hero__download,
  body[data-download="hud"].page-places a.cta.hero__download,
  body[data-download="hud"].page-cities #homeIntro a.cta.hero__download {
    flex-basis: 0;
    min-width: 0;
    min-height: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* Sample-reel chrome: clearer clearance under CTAs */
  body.page-people .sample-reel__dots,
  body.page-places .sample-reel__dots,
  body.page-cities #homeIntro .sample-reel__dots {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  body.page-people .sample-reel .look__media,
  body.page-places .hero.sample-reel .look__media,
  body.page-cities #homeIntro .look__media {
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 14px);
  }

  /* Content sections: single-job spacing closer to Apple product pages */
  body.page-people section:not(.hero):not(.sample-reel):not(.vision-panel),
  body.page-places section:not(.hero):not(.sample-reel) {
    padding-top: clamp(3rem, 8vh, 5rem);
    padding-bottom: clamp(3rem, 8vh, 5rem);
  }

  /*
   * Footer 单列饰件对齐：
   * 不要外扩 grid/base/clip（会盖住 frame 左右/底边框线）。
   * 全部左/右饰件统一 left/right:-1px，与 frame 外角同一竖线。
   * 列宽必须 minmax(0, 1fr)：WebKit 下 Subscribe 输入框的固有宽度会把 1fr 撑出边框，
   * 单元格上的饰件（含 .foot-cap）随之外移。
   */
  body.page-people .foot-grid,
  body.page-places .foot-grid,
  body.page-cities .foot-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.page-people .foot-grid > div,
  body.page-places .foot-grid > div,
  body.page-cities .foot-grid > div {
    min-width: 0 !important;
    position: relative !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  body.page-people .foot-grid > div + div,
  body.page-places .foot-grid > div + div,
  body.page-cities .foot-grid > div + div {
    border-left: 0 !important;
    border-top: 1px solid var(--line);
  }

  /* 行缝 ├ ┤ */
  body.page-people .foot-grid > div + div::after,
  body.page-places .foot-grid > div + div::after,
  body.page-cities .foot-grid > div + div::after {
    content: "" !important;
    position: absolute !important;
    left: -1px !important;
    right: auto !important;
    top: -7px !important;
    bottom: auto !important;
    width: 11px !important;
    height: 13px !important;
    transform: none !important;
    z-index: 2;
    background:
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 0 50% / 11px 2.5px no-repeat,
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 0 50% / 2.5px 13px no-repeat !important;
  }

  body.page-people .foot-grid > div + div::before,
  body.page-places .foot-grid > div + div::before,
  body.page-cities .foot-grid > div + div::before {
    content: "" !important;
    position: absolute !important;
    left: auto !important;
    right: -1px !important;
    top: -7px !important;
    bottom: auto !important;
    width: 11px !important;
    height: 13px !important;
    transform: none !important;
    z-index: 2;
    background:
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 11px 2.5px no-repeat,
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 2.5px 13px no-repeat !important;
  }

  body.page-people footer[data-curtain="shut"] .foot-grid > div + div::before,
  body.page-people footer[data-curtain="shut"] .foot-grid > div + div::after,
  body.page-places footer[data-curtain="shut"] .foot-grid > div + div::before,
  body.page-places footer[data-curtain="shut"] .foot-grid > div + div::after,
  body.page-cities footer[data-curtain="shut"] .foot-grid > div + div::before,
  body.page-cities footer[data-curtain="shut"] .foot-grid > div + div::after {
    opacity: 1 !important;
  }

  body.page-people .foot-rules,
  body.page-places .foot-rules,
  body.page-cities .foot-rules {
    grid-template-columns: 1fr !important;
  }

  body.page-people .foot-rules i:nth-child(n+2),
  body.page-places .foot-rules i:nth-child(n+2),
  body.page-cities .foot-rules i:nth-child(n+2) {
    display: none !important;
  }

  body.page-people .foot-rules i:first-child::before,
  body.page-places .foot-rules i:first-child::before,
  body.page-cities .foot-rules i:first-child::before {
    left: -1px !important;
    transform: none !important;
  }

  body.page-people .foot-rules i:first-child::after,
  body.page-places .foot-rules i:first-child::after,
  body.page-cities .foot-rules i:first-child::after {
    content: "" !important;
    position: absolute !important;
    top: 4px !important;
    right: -1px !important;
    left: auto !important;
    width: 11px !important;
    height: 13px !important;
    transform: none !important;
    background:
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 11px 2.5px no-repeat,
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 2.5px 13px no-repeat !important;
  }

  /* logo 顶缝左 ├；Places 清掉 top:50% */
  body.page-people .foot-grid::before,
  body.page-places .foot-grid::before,
  body.page-cities .foot-grid::before {
    content: "" !important;
    position: absolute !important;
    left: -1px !important;
    right: auto !important;
    top: auto !important;
    bottom: -7px !important;
    width: 11px !important;
    height: 13px !important;
    transform: none !important;
    z-index: 2;
    background:
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 0 50% / 11px 2.5px no-repeat,
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 0 50% / 2.5px 13px no-repeat !important;
  }

  body.page-people .foot-grid::after,
  body.page-places .foot-grid::after,
  body.page-cities .foot-grid::after {
    left: -1px !important;
  }

  /*
   * logo 顶缝右 ┤：.foot-cap 在最后一列 cell 内。
   * 定位参考是 cell（非 grid），right 必须与 cell::before / frame 外角同为 -1px。
   */
  body.page-people .foot-cap,
  body.page-places .foot-cap,
  body.page-cities .foot-cap {
    position: absolute !important;
    left: auto !important;
    right: -1px !important;
    top: auto !important;
    bottom: -7px !important;
    width: 11px !important;
    height: 13px !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 2;
    background:
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 11px 2.5px no-repeat,
      var(--foot-t, linear-gradient(var(--accent), var(--accent))) 100% 50% / 2.5px 13px no-repeat !important;
  }

  body.page-people .foot-base::after,
  body.page-places .foot-base::after,
  body.page-cities .foot-base::after {
    right: -1px !important;
  }

  body.page-people .foot-base,
  body.page-places .foot-base,
  body.page-cities .foot-base {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }

  /* Cities board filters: Apple-like tighter horizontal padding */
  body.page-cities #hoods .controls {
    padding: 10px 16px;
    gap: 0.25rem 0;
  }

  body.page-cities #hoods .btn--continent {
    margin: 0 0.4rem 0.3rem 0;
    font-size: 0.82em;
  }
}

/* —— Small phone —— */
@media only screen and (max-width: 480px) {
  /* Keep CTA pair side-by-side like Vision Pro (~390); stack only on very narrow */
  body.page-places .hero__lede-body,
  body.page-cities #homeIntro .hero__lede-body {
    -webkit-line-clamp: 3;
  }

  body.page-people .hero__lockup,
  body.page-places .hero__lockup,
  body.page-cities #homeIntro .hero__lockup {
    font-size: clamp(1.55rem, 9vw, 1.9rem);
  }
}

@media only screen and (max-width: 360px) {
  body.page-people .hero__actions .cta,
  body.page-places .hero__actions .cta,
  body.page-cities #homeIntro .hero__actions .cta {
    flex: 1 1 100%;
  }
}

/* Landscape phone: keep hero usable (Apple has similar max-height guards) */
@media only screen and (max-width: 734px) and (max-height: 480px) and (orientation: landscape) {
  body.page-people .hero.sample-reel .hero__inner,
  body.page-places .hero.sample-reel .hero__inner,
  body.page-cities #homeIntro .hero__inner {
    padding-bottom: 2.25rem;
  }

  body.page-places .hero__lede-body,
  body.page-cities #homeIntro .hero__lede-body {
    -webkit-line-clamp: 2;
  }

  body.page-people .hero__actions .cta,
  body.page-places .hero__actions .cta,
  body.page-cities #homeIntro .hero__actions .cta,
  body.page-cities #homeIntro .hero__ambassador {
    min-height: 36px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }
}
