/* Isolated phone layout. The original desktop stylesheet remains unchanged. */
@media (max-width: 680px) {
  .site-header {
    grid-template-columns: 42px minmax(0, 1fr);
    padding-inline: 20px;
  }

  .brand { width: 36px; height: 36px; font-size: 12px; }
  .nav-links { gap: clamp(10px, 3vw, 18px); font-size: 12px; }
  .nav-links a { display: grid; align-items: center; min-height: 44px; }

  .hero {
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    padding: 22px 20px 28px;
    background-size: 40px 40px;
  }

  .hero-keywords {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 8px;
    font-size: 11px;
  }

  .hero-keyword { min-height: 28px; display: flex; align-items: center; }
  .hero-year {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 18px;
    font-size: 12px;
  }
  .hero-year span:last-child { font-size: 9px; }
  .hero-motion { inset: 132px -20vw auto; }
  .hero-content { align-self: start; padding-top: 44px; gap: 16px; }
  .hero-season { font-size: 12px; margin: 0 0 -5px; }
  .hero h1 { font-size: clamp(40px, 13.6vw, 76px); line-height: 1.12; gap: 4px; }
  .hero h1 > span { flex-wrap: nowrap; }
  .hero-role { max-width: 30em; font-size: 10px; line-height: 1.6; }
  .hero-focus { font-size: 14px; }
  .hero-actions { margin-top: 2px; gap: 10px; }
  .hero-work-link, .hero-text-link { min-height: 44px; padding-inline: 18px; font-size: 13px; }
  .hero-stats { margin-top: 28px; gap: 12px; width: 100%; }
  .hero-stats div { padding-top: 12px; gap: 6px; }
  .hero-stats dt { font-size: 26px; }
  .hero-stats dd { font-size: 10px; line-height: 1.6; font-weight: 500; }

  .profile-section, .skills-section { padding: 40px 20px; }
  :is(.profile-section, .skills-section) .section-heading {
    grid-template-columns: 28px minmax(0, 1fr);
    margin-bottom: 24px;
  }
  :is(.profile-section, .skills-section) .section-heading h2 { font-size: 30px; line-height: 1.2; }
  :is(.profile-section, .skills-section) .section-heading > span { font-size: 10px; }
  :is(.profile-section, .skills-section) .section-kicker { font-size: 9px; line-height: 1.6; margin-bottom: 12px; }
  .profile-layout { gap: 28px; }
  .profile-copy h3 { max-width: 17em; font-size: 23px; line-height: 1.5; text-wrap: pretty; }
  .profile-copy p:not(.section-kicker) { margin-top: 16px; font-size: 14px; line-height: 1.85; color: #5b5b5b; }
  .profile-points { gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
  .profile-points li { grid-template-columns: 6px 1fr; gap: 10px; font-size: 13px; line-height: 1.8; }
  .profile-points li::before { width: 4px; height: 4px; margin-top: 10px; }
  .profile-facts { gap: 24px; }
  .profile-facts article > span { margin-bottom: 14px; font-size: 11px; }
  .profile-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .profile-info-grid p { min-height: 0; gap: 6px; padding-bottom: 12px; }
  .profile-info-grid strong { font-size: 17px; line-height: 1.4; }
  .profile-info-grid small { font-size: 10px; }

  .software-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .software-list li {
    min-height: 0;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    gap: 5px 9px;
    padding: 14px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .55);
    text-align: left;
  }
  .software-icon { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 9px; box-shadow: none; }
  .software-list strong { font-size: 12px; line-height: 1.4; overflow-wrap: normal; }
  .software-list small { font-size: 9px; line-height: 1.5; font-weight: 500; }
  .software-list li:last-child { grid-column: 1 / -1; }

  .skills-layout { gap: 22px; }
  .skills-intro { padding-top: 16px; }
  .skills-intro h3 { font-size: 25px; line-height: 1.4; }
  .skills-intro h3 br { display: none; }
  .skills-intro-copy { max-width: none; margin-top: 14px; font-size: 14px; line-height: 1.85; }
  .skills-intro-copy + .skills-intro-copy { margin-top: 10px; }
  .skills-intro-directions { margin-top: 16px; padding-top: 12px; font-size: 10px; }
  .capability-grid { grid-template-columns: 1fr; gap: 0; }
  .capability-grid article {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px 10px;
    min-height: 0;
    padding: 18px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  .capability-grid article:first-child { border-top: 1px solid var(--line); }
  .capability-grid article::before { display: none; }
  .capability-grid article > span { padding-top: 2px; font-size: 10px; }
  .capability-grid h4 { margin: 0; font-size: 17px; line-height: 1.5; }
  .capability-grid p { grid-column: 2; font-size: 13px; line-height: 1.8; }

  .mobile-collapsible:not(.mobile-expanded) > .mobile-secondary { display: none; }
  .mobile-disclosure:not([hidden]) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 44px;
    margin-top: 18px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    scroll-margin-block: calc(var(--header-height) + 16px) 20px;
  }
  .skills-layout > .mobile-disclosure { margin-top: -6px; }
  .mobile-disclosure::after { content: "+"; font-size: 18px; font-weight: 400; line-height: 1; }
  .mobile-disclosure[aria-expanded="true"]::after { content: "−"; }
  .mobile-disclosure:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
  .mobile-disclosure:active { background: var(--soft); }

  /* Give the tab rail a bounded width so its contents scroll within the phone. */
  .works-toolbar { min-width: 0; flex-wrap: nowrap; gap: 10px; }
  .works-toolbar .filter-tabs {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0;
    scrollbar-width: thin;
    scrollbar-color: #b8b8b8 transparent;
    -webkit-mask-image: none;
    mask-image: none;
    touch-action: pan-x pan-y pinch-zoom;
    cursor: grab;
  }
  .works-toolbar .filter-tabs::-webkit-scrollbar { display: block; height: 3px; }
  .works-toolbar .filter-tabs::-webkit-scrollbar-thumb { background: #b8b8b8; border-radius: 3px; }
  .filter-tabs.is-dragging { cursor: grabbing; user-select: none; scroll-snap-type: none; }
  .filter-tabs .filter-tab { flex: 0 0 auto; min-height: 44px; }
  .mobile-filter-hint:not([hidden]) {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
  }

  /* Retouch cards use the phone content width instead of the desktop 320px cap. */
  #works .work-rail.is-retouch-rail {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  /* Center media within phone cards, while keeping headings and copy aligned. */
  #works .aigc-case-lead > .aigc-media {
    justify-self: center;
    max-width: 100%;
  }
  #works .aigc-media img,
  #works .aigc-media video {
    margin-inline: auto;
    object-position: center;
  }
  #works .aigc-media figcaption { text-align: center; }
  #works .aigc-original { margin-inline: auto; text-align: center; }
  #works .aigc-reference { margin-inline: auto; }
  #works .aigc-series,
  #works .aigc-retouch-grid { justify-content: center; }
  #works .aigc-retouch-original .aigc-media { width: fit-content; max-width: 100%; margin-inline: auto; }
  #works .aigc-video-pair .aigc-media { justify-self: center; max-width: 100%; }
  #works .aigc-workflow .aigc-original,
  #works .aigc-retouch-workflow .aigc-original { width: 100%; }

  #works .aigc-sync-controls { gap: 8px; margin-top: 14px; }
  #works .aigc-sync-controls button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 4px;
  }
  .mobile-sync-sound { color: var(--ink); background: transparent; }
  #works .aigc-sync-status { font-size: 10px; line-height: 1.6; }
  /* Shared controls below the comparison replace the native iPhone overlay. */
  .is-replacement-case video::-webkit-media-controls,
  .is-replacement-case video::-webkit-media-controls-enclosure { display: none !important; }

  /* Keep the exit reachable even after scrolling far down a long image. */
  .work-lightbox .work-lightbox-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 12px;
    right: auto;
    width: auto;
    height: 40px;
    padding: 0 14px;
    z-index: 110;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 20px;
    background: rgba(17, 17, 17, .85);
    color: #fff;
    font-size: 13px;
    transform: none;
  }
  .work-lightbox-close::before {
    content: "← 返回作品";
    position: static;
    width: auto;
    height: auto;
    background: none;
    transform: none;
  }
  .work-lightbox-close::after { display: none; }
  .work-lightbox { padding-top: calc(env(safe-area-inset-top, 0px) + 64px); }
  .aigc-viewer-toolbar { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }

  /* Align the section itself beneath the fixed header, then center its contents. */
  #contact {
    min-height: calc(100svh - var(--header-height));
    padding: 56px 16px 32px;
    scroll-margin-top: var(--header-height);
  }
  #contact .contact-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "thanks" "main" "qr" "side";
    justify-items: center;
    gap: 18px;
    padding: 0;
    text-align: center;
  }
  #contact .contact-thanks { font-size: clamp(40px, 13vw, 64px); line-height: 1; }
  #contact .contact-main { width: 100%; }
  #contact .contact-main .section-kicker {
    max-width: 30em;
    margin: 0 auto 10px;
    font-size: 9px;
    line-height: 1.6;
  }
  #contact .contact-panel h3 { font-size: 28px; line-height: 1.3; }
  #contact .contact-list { justify-items: center; gap: 12px; margin-top: 18px; }
  #contact .contact-item {
    width: fit-content;
    max-width: 100%;
    min-height: 32px;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    font-size: 18px;
    line-height: 1.4;
    text-align: left;
  }
  #contact .contact-email { font-size: clamp(14px, 4.2vw, 17px); }
  #contact .contact-item img { width: 22px; height: 22px; }
  #contact .contact-panel .wechat-card {
    width: clamp(144px, 42vw, 180px);
    justify-self: center;
    padding: 10px;
    gap: 8px;
  }
  #contact .wechat-card figcaption { font-size: 11px; }
  #contact .contact-side { justify-self: center; }
  #contact .contact-side .section-kicker { font-size: 9px; }
  #contact [data-reveal] { opacity: 1; transform: none; transition: none; }

  /* Long text groups stay visible during a fast swipe, without delayed reveals. */
  :is(.profile-section, .skills-section) [data-reveal] { opacity: 1; transform: none; transition: none; }
}
